c - Putting a #endif inside a #if -



c - Putting a #endif inside a #if -

is possible set #endif within #if block's 'content' not pair #endif #if?

#if (some_condition) #if (another_condition) #endif // pair endif #if (some_condition) #if (some_condition) #endif // pair endif #if (another_condition) #endif // pair endif #if (some_condition)

if not possible how conditionally compile #if ... #endif pair?

this doing.

i modifying code base of operations bought company. compile , without modifications using macro shown below.

#if (my_company_edits_enabled) // modified code goes here #else // unmodified code company #endif

in way compile in/out modifications while maintaining readability edits. using same #if #else #endif blocks everywhere. came across code beingness compiled in, in original unmodified code base, based on macro value.

#if (feature_a_is_enabled) // line 1 // line 2 #endif

but want compile code [line 1 , line 2] regardless of macro value feature_a_is_enabled

my first thought follow same convention used till [to maintain readability edits].

#if (my_company_edits_enabled) //#if (feature_a_is_enabled) #else #if (feature_a_is_enabled) #endif // line 1 // line 2 #if (my_company_edits_enabled) // #endif #else #endif #endif

then realized not possible.

i know, alternative methods exist accomplish same. wondering whether utilize same convention

#if (my_company_edits_enabled) // modified code goes here #else // unmodified code company #endif

in case too.

no, it's not possible. first #endif matched recent #if or #else, code interpreted this:

#if (some_condition) #if (another_condition) #endif // pair endif #if (another_condition) #if (some_condition) #endif // pair endif sec #if (some_condition) #endif // pair endif first #if (some_condition)

c c-preprocessor

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -