Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Global variables in Upp
Re: Global variables in Upp [message #28691 is a reply to message #28688] Sun, 12 September 2010 09:52 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Jerson,

There is a nice helper for this kind of situation in U++. The macro GLOBAL_VAR (probably undocumented too Smile ). It creates a function returning static variable, so in effect it can be used as global variable accessible wherever you declare the function and BLITZ-safe. The usage is simple, e.g.:
GLOBAL_VAR(int,gvar);
gvar() = 5; //setting
int b = gvar(); //getting

The price is typing the extra two parenthesis, but as global variables are not used very often, it should be not a big trouble.

Best regards,
Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Limits check in Meter code
Next Topic: GLCtrl: does it support multisamplig feature?
Goto Forum:
  


Current Time: Thu May 09 09:31:50 CEST 2024

Total time taken to generate the page: 0.02635 seconds