Something about sizeof(char)

Paolo Carlini pcarlini@suse.de
Mon Jun 14 16:09:00 GMT 2004


Jack Lloyd wrote:

>CHAR_BIT in limits.h is the only portable way to tell that I can think of. You
>can figure it out at runtime by, for example, setting an unsigned char to 1,
>and then up shifting it, see how many times you have to shift before it becomes
>zero.
>  
>
In the implementation of the library we can definitely use predefined 
macros such as
__CHAR_BIT__. We are already doing that in many places, for instance in 
std_limits.h

>Does GCC actually support any CPUs that don't have 8 bit bytes? The most recent
>one I can think of is the PDP-10, and the idea of running C++ code on such a
>box is... a little scary.
>  
>
c4x has 32 bits per char...

Paolo.



More information about the Libstdc++ mailing list