In article <ce56ea3d797a84d83b7c83620832b...@quanstro.net>, erik quanstrom <quans...@quanstro.net> wrote: >> gcc happily compiles a definition like >> #define CT_v249 ((void*)startLabel+464) >> > >no it doesn't. > >$ cat > x.c >char *startlab; >long long offset = (void*)startlab+464; >[...] >$ gcc -Wall x.c >x.c:2: error: initializer element is not constant
That also has the issue of converting a void * to a long long, which may or may not work on the platform in question. Notwithstanding that, there's also the case where it may be say a non-static local which would be ok. Anyway, to the OP, eric's point is that the #define by itself may be fine, but *using it* as constant intializer is not, since the value of startLabel, if it's something like a char *, is not for use as a constant intiailizer (so adding 464 to it is not either). -- Greg Comeau / 4.3.10.1 with C++0xisms now in beta! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?