Can I use #undef this way?
Posted
by flyout
on Stack Overflow
See other posts from Stack Overflow
or by flyout
Published on 2010-05-27T22:57:15Z
Indexed on
2010/05/27
23:01 UTC
Read the original article
Hit count: 228
I want to get some settings I store in the registry, and if they differ from a #define I want to redefine it, could I do it this way?:
#define DEFINED_X "testSetting"
void LoadConfig()
{
regConfigX = some value previusly stored in the registry;
if(regConfigX!=DEFINED_X)
{
#undef DEFINED_X
#define DEFINED_X regConfigX
}
}
I tought #define was used only when compiling, would this code work when running the compiled exe?
© Stack Overflow or respective owner