rather than #ifdef

I am working on some stuff with 4711 #ifdefs and, on most global searches, end up looking at inactive code.

To obtain 'marked' code lines I tried to replace

#ifdef BLAH
.......

with
//#define BLAH
#define BLAH //
BLAH ....

this works for BLAH = nothing, but I can't find a way to make it work for '//'

any ideas?

Erik

Parents
  • You're not being terribly clear what it is you're actually looking for, but I suspect the closest equivalent would be

    #ifdef USE_FEATURE_FOO
    # define FOO_ONLY(x)  x
    #else
    # define FOO_ONLY(x)  /*nothing*/
    #endif
    
    FOO_ONLY(whatever code;)
    FOO_ONLY(and more of it;)
    

    But in the end, if you have enough of such code to make that kind of cruft look like an option worth having, you need to find an entirely different editing tool (one that actually knows the difference between C code and alphabet soup). Or a different coding strategy.

Reply
  • You're not being terribly clear what it is you're actually looking for, but I suspect the closest equivalent would be

    #ifdef USE_FEATURE_FOO
    # define FOO_ONLY(x)  x
    #else
    # define FOO_ONLY(x)  /*nothing*/
    #endif
    
    FOO_ONLY(whatever code;)
    FOO_ONLY(and more of it;)
    

    But in the end, if you have enough of such code to make that kind of cruft look like an option worth having, you need to find an entirely different editing tool (one that actually knows the difference between C code and alphabet soup). Or a different coding strategy.

Children
More questions in this forum