Working with Inactive Code - ifdef Support

Source Insight’s C/C++ and Resource File parsers can recognize inactive blocks of code that are disabled at compile-time with #ifdef, #if, and #elif directives. The Options > Preferences: Language dialog box has a set of “Conditions” buttons that allow you to edit the list of known conditional constants. You can also edit the conditions using the Edit Condition command on the right-click menu of a source window.

By default, Source Insight ignores the conditional directives altogether. It attempts to make sense of all branches in a conditional compilation construct. Often, this works well because declarations in the conditional branches do not interfere with each other.

However, sometimes a tricky declaration may be broken in the middle with an #ifdef. This will often confuse Source Insight. For example:

void DoThing(
    int param1,
#ifdef ABC
    int param2)
    int param2, param3)

In addition, you may not be interested in code that is inactive. For these reasons, Source Insight lets you specify condition values.

Blocks of code that are inactive are displayed in the “Inactive Code” style. For example:

Figure 4.6 The “Inactive Code” style is displayed.