This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C51: Invalid int expression in pre-processor

I have hit a wall. In the following fragment:

int a;

void main(void) {

  a = 1;

#if ((defined(TEST_1) && (TEST_1 == 27)) ||
     (defined(TEST_2) && (TEST_2 == 27))   )
  a = 2;
#endif

}

the conditional compilation crashes with diagnostic:
>
> *** ERROR C308 IN LINE 8 OF PreProc00.c: invalid integer const expression
>

This comes from V8.02 of C51.

It doesn't matter whether TEST_1 & TEST_2 are #defined in
the source file, defined in the compiler's command line, or
not defined at all. I can't find anything wrong with my
parentheses.

What am I missing here?

============================================================
Gary Lynch           |   To send mail, no$pam in domain name
lynchg@no$pam.com    |   must be changed to stacoenergy.
============================================================

Parents Reply Children