Compiler Directives

Discussion in 'Basic4ppc Wishlist' started by Louis, Sep 28, 2008.

  1. Louis

    Louis Active Member Licensed User

    Is there any possibility of adding compiler directives to compile certain statements if a MACRO type definition is defined? E.G. like in C:
    #define num 1
    #if num
    // Compile This Code
    #else
    Compile This Code
    #endif

    It would help for projects that have debugging statements throughout the program, and if a symbol is not defined, (or macro) then the statements are NOT compiled. What do you think?
     
  2. Cableguy

    Cableguy Expert Licensed User

    That would render tha code a bit too complex for us who DON'T know C....
     
  3. Louis

    Louis Active Member Licensed User

    Hi. It could somehow be implemented, not like C, but in such a way that we could have code compiled based on optional conditions. E.G. Let's say I have a program with some debug code, and I want this code removed before building the release executable. Rather than look through the code for all debug statements, if a variable, one that I choose, isn't defined then code in between the special conditional statements won't be included in the program. This will make executables faster as the program won't have to check if a variable is set to true or false at runtime, but instead it checks the conditions at compiletime, thus excluding any code when compile conditions are false. Make sense anyone?
     
  4. Cableguy

    Cableguy Expert Licensed User

    you mean like a [debug] some debug coding [/debug] tagging?
    ????
    That would be good...
     
  5. Louis

    Louis Active Member Licensed User

    Exactly, But people could use it to have code included or excluded for various reasons, not just for compiling. HTH.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice