Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDE Conditional Block Highlighting

SETUP:

Imagine I have a pretty good size program, and #defines and various means of including/excluding various pieces of code are in use.

I.E. Suppose I have a piece of code like this

example_file.c:

include <definition_file>

#ifdef THIS
  do something really cool here
#ifdef THAT
  do something even cooler
#endif
#endif

definition_file.c:

#define THAT TRUE
#define THIS FALSE

Right now I don't know that neither statement will be included or used unless I look in definition. The above is a simple example, but suppose you have say 50 ifdefs and they're nested in varying ways, tracking down what each of the 50 values are is kinda a pain in the butt.

QUESTION:

Does a program/environment exist that would for example gray out or highlight the entire piece of code indicating that based on your "control file" they won't be included or will be included. (some sort of visual or other indication)

NOTE: If someone can improve the name or the question please by all means, I'm really at a loss what to call this. (or suggest better tags too)

like image 275
onaclov2000 Avatar asked Feb 22 '23 22:02

onaclov2000


1 Answers

Visual Studio 2010 will do this for both C++ (with various degrees of success) and C# (100% reliable).

I assume you don't want to hear about alternatives involving code refactoring (polymorphism, different libraries and choosing at link time what to link to, etc.)

like image 64
Blindy Avatar answered Mar 08 '23 09:03

Blindy