Post Reply 
Global variable
06-26-2017, 05:27 AM
Post: #3
RE: Global variable
Hello,

As a general rules, try to reduce the use of global variables.
Global variables (exported or not), in theory, should be limited to variables that needs to live PAST the end of the execution of the program.

While it is true that using a global variable is an easy way to deal with data that needs to be used by multiple functions, it is much cleaner to pass said data to the functions as parameters and have them be local variables of the calling function. This usually avoids a lot of problems!

If you indeed have a LOT of variables, you can group them in a list passed as a parameter and use the list sto/recal syntax to access them.

They are a number of home global variables (L1, A-Z...), but using them in programs, although easy, is not the cleanest way to do things. You should use your own variables as much as you can.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Global variable - Powersoft - 06-25-2017, 06:56 PM
RE: Global variable - DrD - 06-25-2017, 07:46 PM
RE: Global variable - cyrille de brébisson - 06-26-2017 05:27 AM
RE: Global variable - toml_12953 - 06-26-2017, 12:27 PM
RE: Global variable - DrD - 06-26-2017, 11:48 AM
RE: Global variable - Han - 06-26-2017, 03:09 PM
RE: Global variable - DrD - 06-26-2017, 04:02 PM
RE: Global variable - Han - 06-26-2017, 08:29 PM
RE: Global variable - DrD - 06-26-2017, 09:04 PM
RE: Global variable - DrD - 06-27-2017, 11:32 AM



User(s) browsing this thread: 1 Guest(s)