gcc bug (was: Re: You _CAN_ "stringize" tokens in (some) K&R pre-processors)

John E. Davis davis at pacific.mps.ohio-state.edu
Thu Apr 4 12:56:42 AEST 1991


In article <2127 at gold.gvg.tek.com> shaunc at gold.gvg.tek.com (Shaun Case) writes:
[...]
   #include <stdio.h>

   #define quote "
   #define stringize(a) (quote a"+1)

   main()
   {
           printf("[%s]\n",stringize(foo));
   }

   --- cut here ---

   Is there some reason why this is a bad idea? 


I compiled it and ran it on a sun4 using CC as well as cc.  It ran as
expected.  However it failed to run under gcc:

[pacific]>gcc test.c
test.c: In function main:
test.c:8: `foo' undeclared (first use this function)
test.c:8: (Each undeclared identifier is reported only once
test.c:8: for each function it appears in.)
[pacific]>   

So does this mean there is a bug in gcc?

--
John

  bitnet: davis at ohstpy
internet: davis at pacific.mps.ohio-state.edu



More information about the Comp.lang.c mailing list