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]

passing #define-d values to #define-d macros


i can seem to get this to work:

#define PREFIX "____p_"
#define HIGHER_INTERFACE(id) ____LOWER_INTERFACE(PREFIX, id)

#define ____LOWER_INTERFACE(prefix, id) struct prefix##id \
{ \
int i; \
}

int main(void)
{
HIGHER_INTERFACE(0);

/* test if struct declaration went well: */
struct ____p_0 var;
return 0;
}




when i compile with gcc 4.3.3 it says:
"error: storage size of 'var' isn't known"

i know c preprocessor has MANY shortcomings (or maybe it isn't, maybe those
were supposed to be handled by the development environment's make system)...
but if you're writing libraries that can be easily ported to many system
with VERY LITTLE modification, shouldn't this tiny functionality been
adressed?? an escape character would've been nice....
-- 
View this message in context: http://old.nabble.com/passing--define-d-values-to--define-d-macros-tp29815182p29815182.html
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]