tech-userlevel archive

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

char==int? [was Re: using the interfaces in ctype.h]

>>>     #define _CTYPE_MASK     ~(UINT_MAX << CHAR_BIT)
>> Hoho, if sizeof (char) == sizeof (int).
> I believe that that's impossible.  The C standard doesn't explicitly
> say it's impossible, but the requirement that gets() be able to
> return EOF as well as returning any possible character strongly
> implies that sizeof(int) > sizeof(char).

(1) What about freestanding implementations?

(2) Even for hosted implementations, must getc() (I assume you meant
getc(), not gets()) be able to return any value a char - well, an
unsigned char - can assume?  (Basically, may the execution character
set be smaller than the set of values an unsigned char can assume?)

(3) Are there constraints on how UCHAR_MAX compares to
CHAR_MAX-CHAR_MIN?  I'm wondering about non-binary machines.

/~\ The ASCII                           der Mouse
\ / Ribbon Campaign
 X  Against HTML     
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index