NO

Author Topic: Minor compiler (preprocessor?) issue  (Read 3465 times)

yellowsub

  • Guest
Minor compiler (preprocessor?) issue
« 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.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2076
    • http://www.smorgasbordet.com
Minor compiler (preprocessor?) issue
« Reply #1 on: November 06, 2004, 10:05:03 pm »
Still a problem in 2.90.19 - I will try to fix it.

Pelle
/Pelle

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2076
    • http://www.smorgasbordet.com
Minor compiler (preprocessor?) issue
« Reply #2 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
/Pelle