Minor compiler (preprocessor?) issue

Started by yellowsub, November 06, 2004, 04:50:36 PM

Previous topic - Next topic

yellowsub

The following code generates a compiler error (and shouldn't):


#include <stdio.h>

#define BITMASK 54

int main(int argc, char** argv)
{
unsigned short num;

num = (0xff-BITMASK);
printf("The number is %d\n", num);
return 0;
}


Below is a workaround:

#include <stdio.h>

#define BITMASK 54

int main(int argc, char** argv)
{
unsigned short num;

num = (0xff - BITMASK);
printf("The number is %d\n", num);
return 0;
}

The only difference between the two code samples is the addition of whitespace between the hex constant and the BITMASK constant.  This appears to be a problem in earlier versions of the compiler as well as 2.90.5.

Pelle

Still a problem in 2.90.19 - I will try to fix it.

Pelle
/Pelle

Pelle

OK, I found it. It was the parsing of hexadecimal floating-point constants that got confused about this. Will upload Setup 2.90.1 later.

Pelle
/Pelle