Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-lcc!ptsfa!hoptoad!gnu From: gnu@hoptoad.uucp (John Gilmore) Newsgroups: comp.lang.c Subject: draft ANSI standard: Is a quote a valid preprocessor-token? Message-ID: <1605@hoptoad.uucp> Date: Thu, 1-Jan-87 22:20:19 EST Article-I.D.: hoptoad.1605 Posted: Thu Jan 1 22:20:19 1987 Date-Received: Fri, 2-Jan-87 03:38:34 EST References: <1955@watdragon.UUCP> <184@devon.UUCP> <1581@ihlpl.UUCP> <1971@emory.UUCP> Organization: Nebula Consultants in San Francisco Lines: 40 In article <1971@emory.UUCP>, arnold@emory.UUCP writes: > #define CTRL(X) (' ## X ## ' & 037) /* ascii only */ > ...uses the token concatenation operator to produce the character > constant.... > I am sure someone will correct me if I am wrong. I thought he was wrong, but I looked again at the standard. I didn't believe that a single quote would be considered a preprocessing token; I figured it would parse as #define CTRL(X) (string & 037) where string is: ' ## X ## ' (Of course multiple character '...' constants are legal in the draft proposed standard, but let's not get off the track...) The definition of preprocessor-token is (pg 74, sec 3.8): preprocessing-token: header-name (only within a #include directive) identifier constant string-literal operator punctuator each non-white-space character that cannot be one of the above Aha! Since a lone quote is not any of the above, it must be one of those "each non white space characters", and it must be a preprocessing-token. Right? Phooey. There should be specific instructions in the standard on lexical analysis of C programs, e.g. an algorithm for parsing, rather than this vague English rubbish. This applies to section 2.1.1.2 ("The source file is decomposed into preprocessing tokens...") too. I can see my source files slowly decomposing in there now... -- John Gilmore {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu gnu@ingres.berkeley.edu I forsee a day when there are two kinds of C compilers: standard ones and useful ones ... just like Pascal and Fortran. Are we making progress yet? -- ASC:GUTHERY%slb-test.csnet