Long Chars

Jay Maynard jay at splut.UUCP
Tue Mar 22 22:52:09 AEST 1988


>From article <7447 at brl-smoke.ARPA>, by gwyn at brl-smoke.ARPA (Doug Gwyn ):
> [...] Its only problem is that a fair amount of code has been
> written dependent on the assumption that sizeof(char)==1, although
> some programmers have been careful not to assume that all along. 

My initial knee-jerk reaction to this was "Hey, wait a minute!
sizeof(char) is defined to be 1!" Before I made a fool of myself on the
net (wouldn't be the first time...:-), though, I picked up the copy of
K&R that my recent desk-cleaning revealed. Sure enough, section 7.2, at
the top of page 188 in my copy, says:
"A _byte_ is undefined in the language except in terms of the value of
sizeof. However, IN ALL EXISTING IMPLEMENTATIONS a byte is the space
required to hold a char." (Emphasis added.)

I don't know how much existing code this would break (though I'd bet
there would be quite a bit of it). It does mean that I, too, will be
careful not to make that assumption...

-- 
Jay Maynard, EMT-P, K5ZC...>splut!< | GEnie: JAYMAYNARD  CI$: 71036,1603
uucp: {uunet!nuchat,academ!uhnix1,{ihnp4,bellcore,killer}!tness1}!splut!jay
Never ascribe to malice that which can adequately be explained by stupidity.
The opinions herein are shared by none of my cats, much less anyone else.



More information about the Comp.lang.c mailing list