Announcement

Collapse
No announcement yet.

#IF conditional compilation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #IF conditional compilation

    I'm seeing that this style of writing my code causes a #IF conditional not terminated error on compilation

    case LPIC_MSG_SECOND:
    PILOT_process_second();
    #IF (SETUP) //conditional
    second_elapsed:=TRUE;
    #ENDIF //SETUP
    break;

    but keeping in the #IF #ENDIF above the case level within a switch works just fine

    #IF (SETUP) //conditional
    case LPIC_MSG_SECOND:
    PILOT_process_second();
    second_elapsed:=TRUE;
    break;
    #ELSE
    case LPIC_MSG_SECOND:
    PILOT_process_second();
    break;
    #ENDIF //SETUP

    Is this expected behaviour?


    Thanks,

    Simon

  • #2
    It appears that #IF supports only the == operator.

    So one workaround is to use #IFNOT

    Another thing I often use is

    #IF EXISTS SETUP

    Which will be true or false depending on whether SETUP exists in the program, in that case you would say
    #constant SETUP
    and comment it out for 'the other case'
    Mark

    Comment

    Working...
    X