From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078694111199.tru64-unix-managers.marc@archive.invalid> From: Lew Randerson Date: Mon, 09 Feb 1998 16:23:09 +0000 To: tru64-unix-managers Subject: Embedding # in C preprocessor macros X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078694111199 Re: Embedding # in C preprocessor macros The following file #define ATFB(X) mx#0 ATFB(a) When run through /usr/ccs/lib/cpp on a Digital Unix v4.0B machine gives: # operator should be followed by a macro argument name What's the portable way of including # in macro bodies? -------------------------------------------------------------------- This problem is caused by the addition of 'stringification' aka 'stringization' of tokens which was added to ANSI C. So something like: #define TEST(a,b) prinf( #a "<" #b "=%d\n", (a)<(b) ) TEST(0,0xFFFF); will now under ANSI C become printf("0<0xFFFF=%d\n", (0)<(0xFFFF) ); In traditional C according to the non-Digital documentation I have: * The character `#' has no special meaning within a macro definition in traditional C. So my question then becomes 1) Is there a way to turn off stringification in cpp? or 2) Is there a way to use # in a macro body even with stringification turned on. Thanks for any help. --Lew lranderson@Pppl.GOV