What should be added to C, call

aglew at ccvaxa.UUCP aglew at ccvaxa.UUCP
Sat May 31 05:11:00 AEST 1986


>>>> o The ability to define multi-line pre-processor macros, using #begdef and
>>>> #enddef statements.  #if and other conditionals in the body of the
>>>> definition would be evaluated when the macro was not interpreted, not when
>>>> it is encountered.
>>>
>>>Why would you want to use it?
>>
>>When your macro won't fit on a line, and/or you want to use #if's etc
>>as part of the macro, obviously. 
>
>If your macro won't fit on a line, you can already handle this problem by
>finishing off each line except the last with a backslash.
>The other addition would be a win, though.

Sorry, backslashes don't help macros that I want to have conditional
sections of code in. Eg. I can't do

#define debugf(parmlist) \
#ifdef DEBUG \
	printf parmlist \
#else \
	/* nothing */ \
#endif

I have to embed the #define within the #if instead.

NB. I can't even do this if I finish each line by \\\, unfortunately.

However, if you're going to have a multiline macro sequence, it would
be nice to have some way of distinguishing conditionals that I want
evaluated when the macro is recognized from conditionals that I
want evaluated at macro use time. All of these problems have been solved 
a hundred times in various macro languages - the solutions are all
#######iffy.

Andy "Krazy" Glew. Gould CSD-Urbana.    USEnet:  ihnp4!uiucdcs!ccvaxa!aglew
1101 E. University, Urbana, IL 61801    ARPAnet: aglew at gswd-vms



More information about the Comp.lang.c mailing list