l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2006 Jun 03 20:27

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] C - passing chars and pointer to chars
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] C - passing chars and pointer to chars

On Fri, Jun 02, 2006 at 11:31:43AM -0400, Peter Jay Salzman wrote:
> Apparently, there's no problem assigning the different chars to each other.
> The compiler does the automatic conversion:


I've been reading Thinking in C++, to ramp up on C++ knowledge for work,
and this is discussed.

In C++...

  A static_cast is used for all conversions that are well-defined.
  These include "safe" conversions that the compiler would
  allow you to do without a cast and less-safe conversions that are
  nonetheless well-defined.  The types of conversions covered by
  static_cast include typical castless conversions, narrowing
  (information-losing) conversions, forcing a conversion from a void*,
  implicit type conversions, and static navigation of class hierarchies...

it goes on...

  Promoting from an int to a long or float is not a problem because
  the latter can always hold every value that an int can contain.
  Although it's unnecessary, you can use static_cast to highlight these

  Converting back the other way is shown [in an example in the book].
  Here, you can lose data because an int is not as "wide" as a long or
  a float; it won't hold numbers of the same size.  Thus these are called
  narrowing conversions.  The compiler will still perform these, but will
  often give you a warning.  You can eliminate this warning and indicate
  that you really did mean it using a cast.

HTH somehow!

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.