Programming style, avoiding globals.

Blitz3D Forums/Blitz3D Programming/Programming style, avoiding globals.

that I know what your code looks like, but if you're using types effectively, you ought to be able to *save* the number of parameters you're passing. By passing a reference to the type entry (rather than a specific field) all of the individual fields can be referenced by the function, using that one parameter. When passing a user-defined type like this, you're only passing a pointer to the data container, so the overhead is minimal.


Agreed. The technique is only employed with variables shared by many types that are not fields of a specific type.

I have found that adopting a Verbose Label Convention can prevent code conflicts and improves portability. Even with using Globals! The convention can be as simple as using a label prefix for all types, variables, arrays, functions, etc within your library.
MyLib_{Label}
Here's a example of a Label Convention that I've adopted
Syntax: 
[Object][Purpose] (ie: ClockSet) 
[Object][Property][Purpose] (ie: ActionIntSet(myaction,index,255)) 
[Object][SubObject][Purpose] (ie: DatabaseRowNext(db)) 
[Object][SubObject][Property][Purpose](ie: CameraRumbleXSet(camera,2.0)) 
Just adding a prefix can allow the code to port anywhere. If you don't adopt a Labeling technique of some sort, it gets very difficult to code large programs because you start running out of labels.