Pelles C forum

Pelles C => Bug reports => Topic started by: yellowsub on November 06, 2004, 04:50:36 PM

Title: Minor compiler (preprocessor?) issue
Post by: yellowsub on November 06, 2004, 04:50:36 PM
The following code generates a compiler error (and shouldn't):

Code: [Select]

#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:
Code: [Select]

#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.
Title: Minor compiler (preprocessor?) issue
Post by: Pelle on November 06, 2004, 10:05:03 PM
Still a problem in 2.90.19 - I will try to fix it.

Pelle
Title: Minor compiler (preprocessor?) issue
Post by: Pelle on November 07, 2004, 03:19:14 PM
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