Variable scope for Program level .prg files

Jason A.
Tucson, AZ

May 16, 2019
2 Posts

0  |  0  

Re: Variable scope for Program level .prg files

Are Program (.prg) level variables considered global?  ATEasy Help page "Variable Naming Conventions" states: use the g_ prefix for global variables; global shows up with a qualifier "Global (for public variables)"  At the Program level scope, variables can't be declared as public.  In the Examples.wsp out of the dozems and dozens of projects that declare Program variables, I only found one with the g_ prefix and the usage of that variable seemed to be the same for all of the rest; which was that the variables are used in Tests.  For example look at the Language.prg variables, none of them use the additional g_ type modifier.


File Attachment:
Global.PNG

Solution Available
DrATEasy (Ron Y.)
Mission Viejo, CA

May 16, 2019
358 Posts

1  |  0  

Re: Variable scope for Program level .prg files

Program variables are only accessible from the program module, so they are not considered public and there is not a need to declare the prefix g_. You could use m_ to differentiate and avoid collusion with program procedure variable, however I don't think it adds lots of value.

for driver and system variables , It make sense to use the g_ or m_ to driver or system variables to avoid duplicate naming and avoid colliding with other variables (procedures or other drivers)



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]