Re: char y = 469;

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tom,

> But you can't verify your code if you don't know the range of the
> inputs, so you'd presumably have some sort of range check before you
> started working with the input, in which case it would be limited to
> 0-127 already (or 0-255 for unsigned char).

That's what the IntToChar or Boost numeric_cast assists in doing, explicitly
at runtime.

Where the range of input for a char is whatever is appropriate on that
platform, and for and int likewise, and for putting an int into a char...
IntToChar or Boost numeric_cast, or as stf_polska coded just the standard
C/C++ slicing behavior (where C/C++ assume the programmer knows what's going
on).

> I assume we all verify our code right?  :-)

Knock on wood!

Sincerely,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux