This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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
  • is what you propose not doing the same as what I posted above?

    No. Because your BLAH define is basically just a comment. It doesn't do anything. You might as well have stuck to an actual comment:

    #ifdef INCLUDE_BLAH
    /*BLAH*/ void blah(void)
    /*BLAH*/ {
    /* oh, and you forgot this: */
    #endif
    

    The difference with my approach is that there's only one #ifdef needed. Every line that would otherwise have to be included into another pair of

    #ifdef INCLUDE_BLAH
    BLAH-only stuff here...
    #endif
    


    can just be put in the BLAH_ONLY() macro instead:

    BLAH_ONLY(BLAH-only stuff here...)
    

Reply
  • is what you propose not doing the same as what I posted above?

    No. Because your BLAH define is basically just a comment. It doesn't do anything. You might as well have stuck to an actual comment:

    #ifdef INCLUDE_BLAH
    /*BLAH*/ void blah(void)
    /*BLAH*/ {
    /* oh, and you forgot this: */
    #endif
    

    The difference with my approach is that there's only one #ifdef needed. Every line that would otherwise have to be included into another pair of

    #ifdef INCLUDE_BLAH
    BLAH-only stuff here...
    #endif
    


    can just be put in the BLAH_ONLY() macro instead:

    BLAH_ONLY(BLAH-only stuff here...)
    

Children
No data