This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Possible bug in preprocessor


Hi. Just wanted to share that the following macro gives an error on latest
versions of GCC, but is reported to work on 2.95.3 (tested on MorphOS but
should be the same for other OSses of course).
Both an old version of SASC(AmigaOS) and Borland (on X86) worked fine.

#include<stdio.h>

#define EXTRACTBRCKTELMNT(Terminator, Elmnt) #Elmnt, #Terminator

#define GETBRCKTELMNT(ToExtract)
GETELMNTEXPAND(EXTRACTBRCKTELMNT##ToExtract)
#define GETELMNTEXPAND(a) GETELMNTEXPAND2 (a)
#define GETELMNTEXPAND2(a, b) a, b


int main (int argc, char **argv)
{ printf("%s %s\n", GETBRCKTELMNT((YYY, XXX)));
  
  getchar();
  return (0);
}


Regs
Jose
-- 
View this message in context: http://www.nabble.com/Possible-bug-in-preprocessor-tf3494353.html#a9760061
Sent from the gcc - Dev mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]