macros with parameters in MSC 5.0
Paul Fox
fox at alice.marlow.reuters.co.uk
Thu Mar 3 08:27:39 AEST 1988
In article <898 at PT.CS.CMU.EDU> edw at 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
More information about the Comp.lang.c
mailing list