It is currently Tue Jan 19, 2021 6:18 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Wrong folding with CompilerIf in Procedure declaration
PostPosted: Thu Jan 07, 2016 4:38 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1789
Location: Germany
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong folding with CompilerIf in Procedure declaration
PostPosted: Thu Jan 07, 2016 6:22 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Oct 09, 2007 2:15 am
Posts: 1151
Thats normal. You have two Procedure Keywords and only one EndProcedure....
Add a ;} after EndProcedure and all is ok ...

Image

_________________
PureBasic 5.72 LTS (Windows x86/x64) | Windows10 Pro x64 | Z370 Extreme4 | i7 8770k | 64GB RAM | iChill GeForce RTX 2080 Super | HAF XF Evo​​
English is not my native language... (I often use DeepL to translate my texts.)


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong folding with CompilerIf in Procedure declaration
PostPosted: Thu Jan 07, 2016 10:05 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1789
Location: Germany
Thank you for posting your workaround! :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong folding with CompilerIf in Procedure declaration
PostPosted: Fri Sep 02, 2016 1:54 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon May 12, 2008 1:25 pm
Posts: 374
Location: The Netherlands
I usually use a method where a Macro contains the body and I simply define the procedure twice.

Code:
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)

_________________
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye