IFDEF Compiler Directives

Post your requests and ideas on the future development of mikroPascal PRO for PIC.
Post Reply
Author
Message
krasi533513
Posts: 11
Joined: 03 Mar 2012 09:45

IFDEF Compiler Directives

#1 Post by krasi533513 » 09 Mar 2015 12:40

Hi there!

Compiler directives like IFDEF are good choice when we need conditional compilation of sections of code, so I frequently use them.

Can I make some kind of "OR" operation with them?
Let me show you an example like that - if we have 4 conditionals - Cond1, Cond2, Cond3, Cond4:

{$IFDEF Cond1 OR Cond2 or Cond3 or Cond4 }
..... one and the same code
..... one and the same code
..... one and the same code
{$ENDIF}


For now, I have to make it like that:

{$IFDEF Cond1 }
..... one and the same code
..... one and the same code
..... one and the same code
{$ELSE}
{$IFDEF Cond2 }
..... one and the same code
..... one and the same code
..... one and the same code
{$ELSE}
{$IFDEF Cond3 }
..... one and the same code
..... one and the same code
..... one and the same code
{$ELSE}
{$IFDEF Cond4 }
..... one and the same code
..... one and the same code
..... one and the same code
{$ELSE}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}


As you see, if that "OR" operation could be used, that will make these stupid duplicates in program text unnecessary. For the final code the duplicates have no meaning, but for the programers eyes to have one and the same long procedure code duplicated it is awful to read... and correct...

If it is not possible now, then it would be nice to have such a "OR" and "AND" for conditionals in future releases.

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: IFDEF Compiler Directives

#2 Post by marina.petrovic » 10 Mar 2015 11:29

Hi,

Thank you very much for your suggestion and detailed explanation, I will pass it to our software developers.

Best regards,
Marina

Post Reply

Return to “mikroPascal PRO for PIC Wish List”