This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Something about sizeof(char)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]