Page 1 of 1

Wrong folding with CompilerIf in Procedure declaration

Posted: Thu Jan 07, 2016 4:38 pm
by Shardik
Image

Re: Wrong folding with CompilerIf in Procedure declaration

Posted: Thu Jan 07, 2016 6:22 pm
by Bisonte
Thats normal. You have two Procedure Keywords and only one EndProcedure....
Add a ;} after EndProcedure and all is ok ...

Image

Re: Wrong folding with CompilerIf in Procedure declaration

Posted: Thu Jan 07, 2016 10:05 pm
by Shardik
Thank you for posting your workaround! :)

Re: Wrong folding with CompilerIf in Procedure declaration

Posted: Fri Sep 02, 2016 1:54 pm
by Crusiatus Black
I usually use a method where a Macro contains the body and I simply define the procedure twice.

Code: Select all

Macro ProcedureName_Body()
  If((a + b) % 2 = 0)
    Debug "Sum is even!"
  Else
    Debug "Sum isn't even! :("
  EndIf 
EndMacro

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  Procedure ProcedureName(a.i, b.i)
    ProcedureName_Body()
  EndProcedure
CompilerElse
  ProcedureC ProcedureName(a.i, b.i)
    ProcedureName_Body()
  EndProcedure
CompilerEndIf

ProcedureName(10, 3)