strcmp

Christopher R Volpe volpe at camelback.crd.ge.com
Sat Jun 22 03:54:48 AEST 1991


In article <6476.Jun2023.30.3491 at kramden.acf.nyu.edu>,
brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
|>On the other hand, how can sizeof(char) == sizeof(int)? I was under the
|>impression that sizeof(char) had to be smaller than sizeof(int).
|>Otherwise the getchar() interface explodes. 

I know of at least one architecture where sizeof(char)==sizeof(int) == 32 bits.
(Although the only compiler for it that I'm aware of is freestanding.)
All that's required is that sizeof(char) be no bigger than sizeof(int).
This won't break the getchar() interface, I believe, because getchar() doesn't
necessarily have to return all values of type char. It has to return all 
characters in the machine's basic character set, plus EOF. So on this machine
the bit patterns for char values -1 through 255 would all be distinct.

-Chris

|>
|>---Dan
                             
==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.lang.c mailing list