Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!shelby!polya!urs From: urs@polya.Stanford.EDU (Urs Hoelzle) Newsgroups: comp.lang.c Subject: '#' in macros (ANSI C) Message-ID: <7782@polya.Stanford.EDU> Date: 16 Mar 89 19:30:45 GMT Sender: Urs Hoelzle Organization: Stanford University Lines: 17 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