Is this correct action for the c compiler/preprocessor ??

Scott R. Anderson sra at oddjob.UUCP
Tue Nov 5 16:19:32 AEST 1985


In article <326 at mcgill-vision.UUCP> mouse at mcgill-vision.UUCP (der Mouse) writes:
>> #define BAD_SEGMENT     29
>> #define ERROR(number)   printf("Error number %d\n",number);
>> main() {
>>        ERROR(BAD_SEGMENT);
>> }
>
>All current preprocessors I know
>of substitute  "number"  inside the double  quotes as  well.  Of course,
>this is not serious; merely rewrite ERROR as
>
>#define ERROR(n) printf("Error number %d\n",n);

Maybe you want a formal argument besides "n"?  This expands into

       printf("Error number %d\BAD_SEGMENT",    29);;	(:-)
-- 

					Scott Anderson
					ihnp4!oddjob!kaos!sra



More information about the Comp.lang.c mailing list