"Michael Wojcik" <mw*****@newsguy.com> wrote in message
news:dj*********@news4.newsguy.com...
After expansion, the second line becomes:
#if ((CFG_CMD_ALL & ~CFG_CMD_NONSTD) & CFG_CMD_IDE)
It's complaining about the first &, not the second.
Again, try ! instead.
I strongly suspect that is wrong.
You're right. I should have tried compiling it here.
But also, how is CFG_CMD_NONSTD defined?
This is indeed the pertinent question. I suspect it's something
like
#define CFG_CMD_NONSTD 2
Actually, that works (here).
I've used this as test code:
#define CFG_CMD_ALL 1
#define CFG_CMD_NONSTD 2
#define CFG_CMD_IDE 1
#define CONFIG_COMMANDS (CFG_CMD_ALL & ~CFG_CMD_NONSTD)
#if CFG_CMD_ALL
#if CONFIG_COMMANDS
#if (CONFIG_COMMANDS & CFG_CMD_IDE)
This all compiles, until it complains that I didn't close the #ifs.
When I change any of those to remove the value, as in
#define CFG_CMD_ALL
I get
x.c(5) : fatal error C1017: invalid integer constant expression
So, what they're defined as is entirely relevant.
Oddly, this code looks familiar to me. I recall working an open source program
which ran on DOS, Unix, WIndows and Linux. It had something like this:
#ifdef PLATFORM_Z
#define CFG_CMD_ALL
/* #define CFG_CMD_NONSTD - Platform Z is standard*/
#define CFG_CMD_IDE
#endif
#ifdef PLATFORM_Y
#define CFG_CMD_ALL
#define CFG_CMD_NONSTD
/* #define CFG_CMD_IDE - Platform Y doesn't support the IDE */
#endif
then used #ifdefs and #ifndefs with them.
#ifdef CFG_CMD_ALL
#ifndef CFG_CMD_NONSTD
#define CONFIG_COMMANDS
#else
#undefine CONFIG_COMMANDS
#endif
... and so on...
- Bill