Re: INT_MIN and compiler diagnostic
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Wed, 28 Feb 2007 12:02:41 -0800
Beej Jorgensen <beej@xxxxxxx> writes:
[...]
(Interestingly, though, I guess I expected the preprocessor to calculate[...]
the final answer before passing it to the compiler, and it doesn't.
And now, it doesn't even make sense that the preprocessor would do it.
I mean, the compiler has to do that kind of stuff anyway, right?
So why did I have it in the back of my mind that the preprocessor
sometimes did simple math? Some holdover from the olden days of not-so-
optimal compilers?)
The preprocessor does do simple math within preprocessor directives.
For example:
#if 2 + 2 == 4
is evaluated by the preprocessor.
Arithmetic expressions outside preprocessor directives may be (and in
some cases, must be) evaluated at compilation time, but not during the
preprocessing phases.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- Follow-Ups:
- Re: INT_MIN and compiler diagnostic
- From: Beej Jorgensen
- Re: INT_MIN and compiler diagnostic
- References:
- Re: INT_MIN and compiler diagnostic
- From: Beej Jorgensen
- Re: INT_MIN and compiler diagnostic
- Prev by Date: Re: syntactically comprehensive test program
- Next by Date: Re: significance of graphics in c
- Previous by thread: Re: INT_MIN and compiler diagnostic
- Next by thread: Re: INT_MIN and compiler diagnostic
- Index(es):
Relevant Pages
|