macros with parameters in MSC 5.0

Al Kulik kulik at xyzzy.UUCP
Sat Feb 20 03:25:51 AEST 1988


>In article <898 at PT.CS.CMU.EDU> edw at IUS1.CS.CMU.EDU (Eddie Wyatt) writes:
>  Does this imply that a macro parameter will nolonger be expanded in
>strings too?

That's right. You have to use the '#' operator, e.g.

#define str(s) # s
        .
        .
        .
char *p = str(somestring);

which results in

char *p = "somestring";

-- 
Al Kulik, Data General.		        Uucp: ...!mcnc!rti!xyzzy!kulik
					Arpa/Csnet:  kulik at dg-rtp.DG.COM



More information about the Comp.lang.c mailing list