none
#ifdef and how to turn on at run time

    Question

  •     Hi All,
    I have a question related to how to set the ifdef value at run time. 
    For example in the code below:
    #ifdef TURN_ON_DEBUG
    .......
    #endif

    How to set TURN_ON_DEBUG at the run time. 
    Thanks,
    Jodie 
    Database
    Thursday, September 04, 2008 5:44 PM

Answers

  • Hello,

    You can't. You should use regular if.

    The conditional compilation is decided at compilation time, that means that if the TURN_ON_DEBUG is defined, the "true" part of the code will be compiled and if not then the "false" part will be compiled.
    • Proposed as answer by Neil Tippett Thursday, September 04, 2008 6:14 PM
    • Marked as answer by Yan-Fei Wei Tuesday, September 09, 2008 8:17 AM
    Thursday, September 04, 2008 5:57 PM
  • #ifdef etc are preprocessor directive which comes in picture at compile time you can't use them at run time

    Thanx

    Rupesh Shukla
    • Edited by Pintu Shukla Thursday, September 04, 2008 5:58 PM space
    • Marked as answer by Yan-Fei Wei Tuesday, September 09, 2008 8:17 AM
    Thursday, September 04, 2008 5:57 PM

All replies

  • Hello,

    You can't. You should use regular if.

    The conditional compilation is decided at compilation time, that means that if the TURN_ON_DEBUG is defined, the "true" part of the code will be compiled and if not then the "false" part will be compiled.
    • Proposed as answer by Neil Tippett Thursday, September 04, 2008 6:14 PM
    • Marked as answer by Yan-Fei Wei Tuesday, September 09, 2008 8:17 AM
    Thursday, September 04, 2008 5:57 PM
  • #ifdef etc are preprocessor directive which comes in picture at compile time you can't use them at run time

    Thanx

    Rupesh Shukla
    • Edited by Pintu Shukla Thursday, September 04, 2008 5:58 PM space
    • Marked as answer by Yan-Fei Wei Tuesday, September 09, 2008 8:17 AM
    Thursday, September 04, 2008 5:57 PM