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!mgnetp!ihnp4!zehntel!hplabs!hao!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.lang.c Subject: Re: unsigned what? Message-ID: <2030@rlgvax.UUCP> Date: Fri, 22-Jun-84 01:31:07 EDT Article-I.D.: rlgvax.2030 Posted: Fri Jun 22 01:31:07 1984 Date-Received: Fri, 22-Jun-84 05:20:37 EDT References: <1990@rlgvax.UUCP> <779@bbncca.ARPA> Organization: CCI Office Systems Group, Reston, VA Lines: 53 "unsigned short x;" and "unsigned long x;" aren't Berkeleyisms. The 4.1BSD C compiler differs from the System III C compiler ("compiler" here refers to "/lib/ccom") in 1) the addition of "flexnames", 2) a mod not to put anything shorter than 32 bits declared "register" into a register, and 3) other very minor changes - these differences were found by using the "diff" command. The System V source file "getty.c" contains the line unsigned short timer; so the System V compiler supports it (any other result would have surprised the living **** out of me). Therefore: 1) the PDP-11 V7 Ritchie compiler already supported them, and your compiler (being based on that compiler) didn't need to be changed to support them. 2) your System V source to "getty.c" (and some other programs, probably) was a PDP-11 distribution; the PDP-11 S5 compiler doesn't support "unsigned short x;"; and all file using this construct were modified not to use it. 3) somebody at BB&N changed "getty.c". I infer from what you say that 3) isn't the case. 2) is unlikely, but not impossible; I put my money on 1). I interpret "8.2 Type specifiers" to say that there are two classes of "type-specifier", adjectives and nouns. "long", "short", and "unsigned" are adjectives, and the others are nouns. ("The words 'long', 'short', and 'unsigned' may be thought of as adjectives...") A declaration consists of one noun ("Otherwise, at most one type-specifier may be given in a declaration.") and several adjectives. The adjectives "short", "long", and "unsigned" may modify "int", and the adjective "long" may modify "float". No other combinations of adjective and noun are permitted. ("...the following combinations are acceptable.") In the statement "If the type-specifier is missing from a declaration, it is taken to be 'int'.", I interpret "the type-specifier" to refer back to the "one type-specifier given in a declaration" mentioned in the previous sentence. As such, in "unsigned short int" the "int" is the missing type-specifier, so "unsigned short" is a declaration with the type-specifier (in the sense used in that sentence) missing and taken as "int". I see no reason this shouldn't be considered a legitimate interpretation; I don't find it far-fetched, forbidding "unsigned" to be applied to "short int" and "long int" reduces the usefulness of the language, *and* it describes current practice for a lot of existing compilers and code. I consider the other interpretations legitimate as well, which is why I consider the passage ambiguous. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy