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_at_Pppl.GOV
Received on Mon Feb 09 1998 - 17:23:25 NZDT