[comp.lang.c] '#' in macros

urs@polya.Stanford.EDU (Urs Hoelzle) (03/17/89)

What are the semantics of # within preprocessor macros in ANSI C
implementations?  When preprocessing the following code fragment,
different compilers seem to disagree what should be done:

#define Test1(x)       #x
#define Test2          #               /* is this legal? */     
#define Test3(x)       \#x

  Test1(hello)                         /* stringization - no problem */
  Test2                 
  Test3(hello)                         /* what should happen here? */

What does ANSI say about this?  I couldn't find any answers in H&S
or K&R. In particular, should the last line produce '#hello' or
'\"hello"' ?

-Urs