PB4 Win32 - Question about Protected

Everything else that doesn't fall into one of the other PB categories.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

PB4 Win32 - Question about Protected

Post by va!n »

Trying to compile following codesnip alert an message that dAngle.d may be already declared. Maybe i misunderstand here something but shouldnt it possible and make sence to protect the variable dAngle.d inside this procedure too? thx

Code: Select all

Procedure ProtectedTest(dAngle.d)
  Protected dReturnValue.d
  Protected dAngle.d  
  ProcedureReturn dReturnValue
EndProcedure
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Then how would you access the procedure parameter?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

since PB4.0,
procedures arguments are now automatically protected.
you can use an argument name even if it already use as global outside the procedure. So you do not need to 'Protected myVar' .
Thus, you'll save one line of code per argument :wink:
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Post Reply