Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: comp.lang.c Subject: Re: cpp macro expansion Message-ID: <7935@utzoo.UUCP> Date: Sat, 18-Apr-87 23:28:01 EST Article-I.D.: utzoo.7935 Posted: Sat Apr 18 23:28:01 1987 Date-Received: Sat, 18-Apr-87 23:28:01 EST References: <2857@linus.UUCP> Organization: U of Toronto Zoology Lines: 25 Keywords: cpp, #define, macro > Which is the correct expansion, or is it left to the cpp implementors? This is one of the (numerous) areas where K&R and such just were not quite explicit enough to provide solid guidance. The interface between cpp and the rest of the compiler is a real minefield, since historically cpp was a separate pass with very limited understanding of C syntax. > Is there a problem with the (our?) Sun version 3.2 cpp? No, its behavior is legitimate. The programmer who assumed that cpp would remove the backslashed newlines entirely and then combine things into one token was relying on an undocumented property of one particular cpp. There is *no* portable pre-ANSI way to get this effect. > What (if anything) does the new standard say about this? It may be kosher in X3J11, given their slightly-expanded view of the meaning of a backslashed newline, but I'd have to study the draft standard very carefully to be sure. I suspect that the backslashed newlines drop out at once, so the thing becomes one token *before* macro substitution, so it still doesn't work. They have defined a way to get the desired effect, but with different and more explicit syntax. -- "If you want PL/I, you know Henry Spencer @ U of Toronto Zoology where to find it." -- DMR {allegra,ihnp4,decvax,pyramid}!utzoo!henry