Path: utzoo!mnetor!uunet!mcvax!ukc!stl!stc!idec!alice!fox From: fox@alice.marlow.reuters.co.uk (Paul Fox) Newsgroups: comp.lang.c Subject: Re: macros with parameters in MSC 5.0 Message-ID: <290@alice.marlow.reuters.co.uk> Date: 2 Mar 88 22:27:39 GMT References: <11879@brl-adm.ARPA> <2631@haddock.ISC.COM> <898@PT.CS.CMU.EDU> Reply-To: fox@alice.marlow.reuters.co.uk (Paul Fox) Organization: Reuters Ltd PLC, Marlow, Bucks, England Lines: 26 In article <898@PT.CS.CMU.EDU> edw@IUS1.CS.CMU.EDU (Eddie Wyatt) writes: >> > #define ctl(c) ('c'&037) >> >... is not allowed in MSC5.0 >> >> Nor in ANSI C. > > Does this imply that a macro parameter will nolonger be expanded in >strings too? > >#define DEBUG_CALL(xxx) if ((xxx) != OK) { \ > (void) printf("xxx\n"); \ > (void) printf("%s %d\n\n",__FILE__,__LINE__);\ > clearline(); } >-- ANSI gets around this via the '#' and '##' operators -- available within the preprocessor phase only. As I read it # define CTRL(x) #x & 037 CTRL(A); gives: "A" & 037 # define CTRL(x) '##x##' & 037 CTRL(A); gives: 'A' & 037