Useless use of preprocessor



  • While searching through some code to find places where it is assumed that "Macintosh" is synonymous with "big endian", I came across this bit of code:

             case embed_qt_movie:
    #ifdef MAC_PLATFORM
    #endif
    #ifdef WINDOWS_PLATFORM
    #endif
    #ifdef UNIX_PLATFORM
    #endif
    #ifdef OS2_PLATFORM
    #endif
                break;

    It's not a one-time thing, either.  This particular file is littered with similar constructs, sometimes with code in the "case" block, more often not, and with the number of platforms varying from one to four.


  • [quote user="Carnildo"]

    While searching through some code to find places where it is assumed that "Macintosh" is synonymous with "big endian", I came across this bit of code:

             case embed_qt_movie:
    #ifdef MAC_PLATFORM
    #endif
    #ifdef WINDOWS_PLATFORM
    #endif
    #ifdef UNIX_PLATFORM
    #endif
    #ifdef OS2_PLATFORM
    #endif
                break;

    It's not a one-time thing, either.  This particular file is littered with similar constructs, sometimes with code in the "case" block, more often not, and with the number of platforms varying from one to four.
    [/quote]

    No, this is perfectly okay. It's a valid set of instructions to be interpreted in Whitespace. (See Google.) You just need to turn on the Whitespace preprocessor. To do that, you need to set the whitespace flag in the call to the compiler. It's a space, followed by a tab, followed by a space. If nothing seems to be happening, just keep trying. ;)


Log in to reply