Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: cpp macro expansion Message-ID: <5764@brl-smoke.ARPA> Date: Thu, 16-Apr-87 09:10:40 EST Article-I.D.: brl-smok.5764 Posted: Thu Apr 16 09:10:40 1987 Date-Received: Sun, 19-Apr-87 05:47:00 EST References: <2857@linus.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 Keywords: cpp, #define, macro In article <2857@linus.UUCP> ms@security.uucp (Mistress Account) writes: >The intent of the developers was that when cpp expands the code, the two >macro arguments would be concatenated together into one token for the >compiler, i.e: MACRO(holy,cow) yields (holy_cow). Unfortunately C a la K&R did not provide any way to do such "token pasting". People using the Reiser CPP (found on most UNIX systems) typically resorted to the following trick: #define GLUE(a,b) a/**/b However, this is not guaranteed to work and, indeed, is guaranteed NOT to work in X3J11-compliant compilers. The X3J11 invention for token pasting is: #define GLUE(a,b) a ## b You will probably not find many compilers implementing this yet, since this part of the spec kept changing.