I'm trying to do some checking whether const or #define is more memory efficient and so I have the fragment
#define TYPE long
#define USECONST
#ifdef USECONST
const TYPE KEYA = 1;
#else
#define KEYA ((TYPE)1)
#endif
boolean v;
This works fine, using constants. However
#define TYPE long
#undef USECONST
#ifdef USECONST
const TYPE KEYA = 1;
#else
#define KEYA ((TYPE)1)
#endif
boolean v;
fails horribly: for example 'boolean does not name a type'. I assumed for a moment I'd not got the #define correct, but then I changed the code to
#define TYPE long
#undef USECONST
#ifdef USECONST
//const TYPE KEYA = 1;
#else
#define KEYA ((TYPE)1)
#endif
boolean v;
and it worked just fine again: the other way (using definitions). I feel like a complete idiot: obviously conditional compilation doesn't work the way I always thought it did, or I've missed a comma somewhere, or something. Any ideas about what is wrong here ?