Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP
Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!houxz!vax135!floyd!cmcl2!seismo!rlgvax!guy
From: guy@rlgvax.UUCP (Guy Harris)
Newsgroups: net.lang.c
Subject: Re: unsigned what?
Message-ID: <1990@rlgvax.UUCP>
Date: Tue, 5-Jun-84 01:06:52 EDT
Article-I.D.: rlgvax.1990
Posted: Tue Jun  5 01:06:52 1984
Date-Received: Wed, 6-Jun-84 05:59:44 EDT
References: <3000026@uokvax.UUCP>
Organization: CCI Office Systems Group, Reston, VA
Lines: 46

> 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

			declaration
			     |
		+------------+-----+----------+
		|                  |          |
	decl-specifiers    declarator-list   ';'
	       |                   |
	+--------------+           +---------+
	|              |                     |
 type-specifier   decl-specifiers      init-declarator
        |              |                     |
   'unsigned'     type-specifier         declarator
                       |                     |
                     'long'              identifier
                                             |
                                            'l'

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".

This passage can either be interpreted as "if you leave all the type-
specifiers out, it's as if you put in 'int'" or "if you have nothing
but 'adjectives', it's as if you put in 'int'" (see the paragraph
containing the above passage, which describes "long", "short", and
"unsigned" as "adjectives").

So the exegesis is dependent on the interpretation of that passage;
the Ritchie and Johnson compilers both use the second interpretation.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy