I've stripped down (with many sweat, blood and almost tears, macro debugging is not for the fainthearted I tell you:() an error I was having in a big complicated macro I'm doing to the code bellow. It runs perfectly in SASC(68k) but not on VBCC, wich complains about an invalid created token. Don't have GCC installed to try but it worked on a PC with Borland compiler;).
So, can someone confirm if this is a bug in VBCC, a nonstandard feature that SASC and Borland's preprocessors happend to have, or what ? Asking this as I want the macro to run on any C compliant compiler (whatever that means:)).
Oh, and since we're at it maybe someone could also try it on GCC, I don't fell like installing it.
Cheers fellow coders :pint:
#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);
}