|
On Mon, 11 Dec 2006, Kurt Anderson wrote:
I know when it comes to Naming everyone has their own method, good or bad. But I was curious if anyone had any standards for naming their global variables. I prefix mine with G@ which I don't particularly like sometimes, but I do want the variable name to be noticeably different when someone is in a procedure so they know the variable is global. One common example of when I do this is for an RRN field.
I don't use prefixes, but I do distinguish global variables. I use all caps for global variables. Otherwise all my code is lower case. Since we have prefixes that indicate what file a given field comes from and fields from files are always global, using a global prefix doesn't make much sense. But using all caps works well because the case instantly indicates scope. It also works well when converting from old RPG III and RPG/36 code. All variables in that old code were global and everything was upper case as well. So when I convert, I add my local variables as lower case and I don't have to do anything with the existing variables as their global scope is already obvious due to being in all caps.
Also, for those of you who do prefix global variables, do you use that prefix when the variable is only ever used in an entry module's mainline code?
My case rule always applies. James Rich It's not the software that's free; it's you. - billyskank on Groklaw
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.