Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!pacbell!att-ih!ihnp4!inuxc!iuvax!bsu-cs!dhesi From: dhesi@bsu-cs.UUCP (Rahul Dhesi) Newsgroups: comp.lang.c Subject: Re: sizeof(char) Message-ID: <2328@bsu-cs.UUCP> Date: 11 Mar 88 11:22:58 GMT References: <11702@brl-adm.ARPA> <243@eagle_snax.UUCP> <2245@geac.UUCP> <2809@haddock.ISC.COM> <17395@watmath.waterloo.edu> <7434@brl-smoke.ARPA> Reply-To: dhesi@bsu-cs.UUCP (Rahul Dhesi) Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 34 Ray Butterworth: Other than allowing sloppily written code to continue to be written, I can see no reason whatsoever for requiring that sizeof(char) be 1. Doug Gwyn: Yes! I would appreciate it if you would send in a comment... Please don't do this. Code that conforms to K&R should not be called sloppy. From page 126: The size is given in unspecified units called "bytes," which are the same size as a char. Existing code will break if sizeof(char) != 1, and let's not blame the programmer for simply taking K&R at face value. And nowhere do I find K&R saying that byte == char == 1 unit is simply a compiler peculiarity and not a design assumption in the language. I have always believed, and I'm sure others share this reasonable belief, that the C programming language is defined by all of K&R, and not just by the brief semi-formal reference manual in the back of the book. I think "long char" is a better bet than changing the meaning of "char". Simply making "char" into two bytes will not allow new code, that needs long characters, to be usable with old compilers anyway. So there is no great need to continue to use the type "char" for long characters (and it could be deceptive to do so). With "long char" one would simply need a new set of str functions such as lstrcmp(), lstrcpy(), etc. So long as we need long chars, and also wish to permit short chars to be used for storage economy, we cannot avoid having two sets of string functions anyway. There is precedence for this sort of change in seek() going to lseek(). -- Rahul Dhesi UUCP: !{iuvax,pur-ee,uunet}!bsu-cs!dhesi