Someone a few months ago told me that I had to change a bunch of code from stuff like this...
// config_options.h
// define _FOO if and only if you want option foo to be available
#ifndef _FOO
#define _FOO
#endif
// main.cpp
#include "config_options.h"
#ifdef _FOO
void foo()
{
cout << "foo\n";
}
#endif
to this...
// config_options.h
// define FOO if and only if you want option foo to be available
#ifndef FOO
#define FOO
#endif
// main.cpp
#include "config_options.h"
#ifdef FOO
void foo()
{
cout << "foo\n";
}
#endif
The reason, she said, was that Visual Studio, or whatever IDE I am using, might define _FOO for whatever reason on its own, thus interfering with my defining it in the .h file. She said that I should define or not define FOO for that reason because the IDE would never do that, but it might define _FOO. Someone else dittoed that, so I changed everything.
Then someone today said that that advice was 100% wrong and that it was better the first time and that the convention, for configuration / ini files where the user changes the code to allow or disallow options, a leading underscore is used to specify that this is a pre-processor name as opposed to, say, a constant.
Who is right?