in C++, I know that programmers use #ifdef 0 to block out code from running, but in this same project I see a lot of #ifdef 1. Does this mean that the code always runs? Unfortunately the code does not compile so I can’t just run and test!
in C++, I know that programmers use #ifdef 0 to block out code from
Share
#ifdef 1is ill-formed. The#ifdefdirective requires a single identifier;1is not an identifier.#ifdef xis equivalent to#if defined(x). Thedefinedpreprocessing operator yieldstrueif the identifier names a defined macro (i.e., a macro that has been defined with#defineand not yet undefined via#undef) andfalseotherwise.The
#ifdirective enables or disables compilation of the lines between it and the corresponding#else,#elif, or#endifdirective that follows it (the directives nest).Chances are, what you are really looking for is
#if 1(or#if 0), which is valid.