#PB_Compiler_InsideProcedure

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

#PB_Compiler_InsideProcedure

Post by Hroudtwolf »

Hi,

It would be cool to have a compiler constant like "#PB_Compiler_InsideProcedure", which has the value #TRUE wenn used inside a procedure.
'Cause it isn't possible to check this by using #PB_Compiler_Procedure with CompilerIf.

Fictive example:

Code: Select all

Macro CastModule ( _MODULE_ )
   CompilerIf #PB_Compiler_InsideProcedure
      Protected *this.t#_MODULE_ = GetModule_#_MODULE_ ()
   CompilerElse
      Define.t#_MODULE_ *_MODULE_ = GetModule_#_MODULE_ ()
   CompilerEndIf
EndMacro
Best regards

Wolf
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

What would you use it for?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

blueznl wrote:What would you use it for?
I think to declare Variables inside Procedure with Protected and outside with Define

This is usefull, not only in OOP programming
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply