Problem while compiling the code

Posted by Atul on Stack Overflow See other posts from Stack Overflow or by Atul
Published on 2010-06-09T06:27:02Z Indexed on 2010/06/09 6:32 UTC
Read the original article Hit count: 164

Filed under:
|
|
|

Can someone points me the problem in the code when compiled with gcc 4.1.0.

#define X 10
int main()
{
  double a = 1e-X;
  return 0;
}

I am getting error:Exponent has no digits.

When i replace X with 10, it works fine. Also i checked with g++ -E command to see the file with preprocessors applied, it has not replaced X with 10. I was under the impression that preprocessor replaces every macro defined in the file with the replacement text with applying any intelligence. Am I wrong?

I know this is a really silly question but I am confused and I would rather be silly than confused :).

Any comments/suggestions.

© Stack Overflow or respective owner

Related posts about c++

Related posts about c