ifdef

C# #if / #ifdef syntax doesn't compile, why ?

Why does the below code not compile (snippet) ? public enum ApplicationType : int { CONSOLE = 1, WINDOWS_FORMS = 2, ASP_NET = 3, WINDOWS_SERVICE = 4, MUTE = 5 } //#if( false) //#if (DEBUG && !VC_V7) #if( m_iApplicationType != ApplicationType.ASP_NET ) public class HttpContext { public...

Cython conditional compile based on external value

I try to conditionally compile (or generate) to c code from a Cython pxd. I read that I can DEF to define aa value and IF to conditionally generate based on its value, but how can I get this value to get from outside of the pxd file? Specifically these two cases are interesting for me now: give some command-line define to Cython, pref...

Visual Studio incorrectly marking inactive code blocks when using `#ifdef`

My project has a bunch of #ifdefs. The macros used by these #ifdefs are usually passed through the command line using the '/D' option to get different build configurations. Visual studio incorrectly assumes that these macros are not defined and greys out the code blocks present inside these #ifdefs. The problem is not syntax highlighting...