Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!pa.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!jit345!diamond From: diamond@jit345.swstokyo.dec.com (Norman Diamond) Newsgroups: comp.lang.c Subject: Re: Many lines from a macro? Message-ID: <1991Jan24.025110.19748@tkou02.enet.dec.com> Date: 24 Jan 91 02:51:10 GMT References: <1991Jan22.201702.1383@quagga.ru.ac.za> Sender: news@tkou02.enet.dec.com (USENET News System) Reply-To: diamond@jit345.enet@tkou02.enet.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo Lines: 54 In article <1991Jan22.201702.1383@quagga.ru.ac.za> cspw@quagga.ru.ac.za (Peter Wentworth) writes: >Can a C macro replacement ever result in more than one output line from >the preprocessing stage? In obscure cases, it is possible, depending on the implementation. But not in any reliable or useful manner. (The imaginable case is where the macro call has arguments on more than one line.) >I am using the SUN assembler which first uses the C preprocessor. Cute. But as you've observed, not especially useful. >The C macro >#define FOO jmp label;\ > nop;\ > label: >expands to this output: jmp label; nop; label: There is no real choice in this matter. The backslash-newline pairs are deleted before the preprocessor even sees the macro definition. >But the assembler insists that the label starts on a new line, >I don't think this can ever cause problems in C, Of course not. >but I suspect >there other languages that would benefit from using a general >standardized C preprocessor as a front end. There is a relatively portable preprocessor called M4. It is cute that no one wants to use M4 to preprocess C programs, but some people want to use the C preprocessor to preprocess programs for other languages. >Was there ever any >notion among the ANSI committee that things like preprocessing >features could be included on grounds of 'general usefulness', >rather than 'useful only to C'? When the ANSI C committee standardized C, even "useful to C" was not always a criterion. Often only "prior art" or "base document" were criteria. In cases were "useful" was the primary criterion, some of the results are unpopular. Other ANSI committees standardize other languages (and other industries besides the computer business). If you want to standardize a macro processor, get a bunch of computer companies together and apply to form another ANSI committee. -- Norman Diamond diamond@tkov50.enet.dec.com If this were the company's opinion, I wouldn't be allowed to post it.