D
David White
What is the correct compiler response to the code below? Mine compiles this
happily and silently (with the #if evaluating to true, naturally). An error
would be helpful.
// MONITOR_CORE.CPP
// oops, forgot to #include header that #defines
// constants REACTOR_TYPE & REACTOR_OLD_MODEL
void MonitorReactorCore()
{
#if REACTOR_TYPE == REACTOR_NEW_MODEL
// nothing to do
// monitored by hardware, with auto-shutdown
#else // REACTOR_OLD_MODEL
if(CoreOverTemperature())
ShutDownReactor();
#endif
// more monitoring code
}
David
P.S. I could not locate the answer in "The C++ Programming Language" (3rd
ed.)
happily and silently (with the #if evaluating to true, naturally). An error
would be helpful.
// MONITOR_CORE.CPP
// oops, forgot to #include header that #defines
// constants REACTOR_TYPE & REACTOR_OLD_MODEL
void MonitorReactorCore()
{
#if REACTOR_TYPE == REACTOR_NEW_MODEL
// nothing to do
// monitored by hardware, with auto-shutdown
#else // REACTOR_OLD_MODEL
if(CoreOverTemperature())
ShutDownReactor();
#endif
// more monitoring code
}
David
P.S. I could not locate the answer in "The C++ Programming Language" (3rd
ed.)