Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: fwrite man page "error" Message-ID: <9813@smoke.BRL.MIL> Date: 8 Mar 89 02:28:50 GMT References: <939@unh.UUCP> <1463@mcgill-vision.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 18 In article <1463@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes: >In article <939@unh.UUCP>, jeff@unh.UUCP (Jeffrey E. F. Friedl) writes: >> I suppose I should tell him that sizeof(char) is !always 1, though. > When sizeof is applied to a char, the result is 1; [...]. >I think the first edition contained something similar, though I'm not >sure. Do you know of any compilers which disagree? K&R 1st Ed. Appendix A, generally taken as the de facto pre-ANSI C standard, says that the units of sizeof are bytes, undefined by the C language. It also notes that in all existing (meaning AT&T) C implementations byte and char are essentially synonymous. The proposed ANSI C standard officially requires the identity between the byte (sizeof unit) and the space used to hold a char. There is apparently a LOT of existing code that relied on that non-guaranteed property, so X3J11 decided it would be a useful service to guarantee it. (I argued against that, for reasons posted to this newsgroup some time ago.)