Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site bbncca.ARPA Path: utzoo!linus!bbncca!keesan From: keesan@bbncca.ARPA (Morris Keesan) Newsgroups: net.lang.c Subject: Re: unsigned what? Message-ID: <779@bbncca.ARPA> Date: Tue, 12-Jun-84 10:40:37 EDT Article-I.D.: bbncca.779 Posted: Tue Jun 12 10:40:37 1984 Date-Received: Wed, 13-Jun-84 04:48:20 EDT References: <1990@rlgvax.UUCP> Organization: Bolt, Beranek and Newman, Cambridge, Ma. Lines: 54 ------------------------------ > > strict exegesis (or pilpul, depending on your religion) of K & R indicates > > that the strings > > > unsigned short > > unsigned char > > unsigned long > > > do not denote legitimate types in C, yet I see these in various places (some > > Berkeley header files, for example). Have these types been blessed somewhere > > (like the enum types) without mention? > > "unsigned long l;" parses as > . > . [parse diagram omitted] > . > and is equivalent to "unsigned long int l;"; the key passage is in > the C Reference Manual, "8.2 Type specifiers": > > If the type-specifier is missing from a declaration, it is > taken to be "int". > > Guy Harris > {seismo,ihnp4,allegra}!rlgvax!guy Actually, the key passage is in the same section Guy cites, just prior to his citation: The words long, short, and unsigned may be thought of as adjectives; the following combinations are acceptable. short int long int unsigned int long float The above is from K&R, and therefore the original poster was right: by omission, strict exegesis of K&R forbids any other combinations. The passage as above also appears in the C Reference Manual in the UNIX V7 documentation. The System V documentation (and perhaps earlier USG/UGLIX versions of C) add unsigned char to the list of acceptable combinations (page 89 of System V "Programming Guide"), so it has been "blessed somewhere", but not without mention (similarly enum types are mentioned, if you know where to look for them). The remaining two forms, unsigned short and unsigned long, are not blessed by any Bell Labs documents that I know of. I know that by adding the two types "unsigned char" and "void" to our V7 C compiler (along with some changes, but without the addition of the two disputed "unsigned" types), we were able to successfully compile all of the System V source. Apparently the long and short of it are Berkeleyisms. Can anyone confirm this? Is there a manual for Berkeley C? -- Morris M. Keesan {decvax,linus,wjh12,ima}!bbncca!keesan keesan @ BBN-UNIX.ARPA