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:59

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?
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 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..

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
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: IFDEF Compiler Directives

#2 Post by filip » 13 Mar 2015 16:30

Hi,

I believe my colleague has answered you on the other post.

Regards,
Filip.

krasi533513
Posts: 11
Joined: 03 Mar 2012 09:45

Re: IFDEF Compiler Directives

#3 Post by krasi533513 » 13 Mar 2015 18:13

Yes, it's doubled post, this one could be deleted...

Post Reply

Return to “mikroPascal PRO for PIC Wish List”