Newsgroups: comp.std.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Macro sustitution inside quotes Message-ID: <1990Apr10.185011.6066@utzoo.uucp> Organization: U of Toronto Zoology References: <636@mahendo.Jpl.Nasa.Gov> <1281@necisa.ho.necisa.oz> <12534@smoke.BRL.MIL> <1284@necisa.ho.necisa.oz> Date: Tue, 10 Apr 90 18:50:11 GMT In article <1284@necisa.ho.necisa.oz> boyd@necisa.ho.necisa.oz (Boyd Roberts) writes: > #define string(s) # s >It is not obvious or intuitive what kind of expansion occurs. Whereas: > #define string(s) "s" >evaluates in the way you would expect. Uh, in the way *who* would expect? I, for one, certainly don't expect the preprocessing phase to look for "identifiers" inside strings! Especially since K&R1 outlawed substitution into strings, albeit with slightly ambiguous language. >Apart from that, # operators break things. Why weren't the Reiser >conventions just formalised? Oh no, that would be too easy. The Reiser conventions are almost impossible to implement in many C compilers, especially the ones that tokenize at preprocessor time rather than doing preprocessor operations on raw text. They were never documented, and in fact they openly violate K&R1, which many non-Unix C implementors used as the basis for their compilers. There is no shortage of existing code which relies on the Reiser botches *not* being done. They were not in any sense a de facto standard -- they were undocumented quirks of the Unix preprocessor. -- Apollo @ 8yrs: one small step.| Henry Spencer at U of Toronto Zoology Space station @ 8yrs: .| uunet!attcan!utzoo!henry henry@zoo.toronto.edu