T
Timo
I am having a problem with some preprocessor constant value checking:
header.h:
#define MY_CONSTANT 1
file.c
#if MY_CONSTANTTT == 1 // <- note the typo!!
// dostuff...
#endif
I have always thought that C-compiler should give error message of
that, because the constant name "MY_CONSTANTTT" doesn't exist.
However,
I got no error message with the line (Tested with MS Visual C++ 6.0
and
with one emdedded system compiler, no other compilers available now).
What I am trying to achieve is to define some product features which
should be included to compilation, in common header file. Usually this
is done with #define USE_FEATURE_XXX. But if programmer writes
"USE_FEATURE_XXX" incorrectly in C source, the code is not
included in compilation, but no error message is got. Example:
#ifdef USE_FEATURE_X // <-typo
// do something
#endif
I am trying to catch possible typing error with this "#if
USE_FEATURE_XXX == 1"
syntax, but it seems not to be working. Have I misunderstood C
standard, or are the compilers I use non-standard?
BR,
Timo
header.h:
#define MY_CONSTANT 1
file.c
#if MY_CONSTANTTT == 1 // <- note the typo!!
// dostuff...
#endif
I have always thought that C-compiler should give error message of
that, because the constant name "MY_CONSTANTTT" doesn't exist.
However,
I got no error message with the line (Tested with MS Visual C++ 6.0
and
with one emdedded system compiler, no other compilers available now).
What I am trying to achieve is to define some product features which
should be included to compilation, in common header file. Usually this
is done with #define USE_FEATURE_XXX. But if programmer writes
"USE_FEATURE_XXX" incorrectly in C source, the code is not
included in compilation, but no error message is got. Example:
#ifdef USE_FEATURE_X // <-typo
// do something
#endif
I am trying to catch possible typing error with this "#if
USE_FEATURE_XXX == 1"
syntax, but it seems not to be working. Have I misunderstood C
standard, or are the compilers I use non-standard?
BR,
Timo