Variable data type prefix
dmulder
Junior Member
I am still in the learning process of programming AMX and I have inherited some code from an existing system. I am trying to comment/clean up as much as I can. Has anyone seen the 'b' prefix used before? The only word that comes to mind is 'boolean'. Example code below.
INTEGER bFireAlarmMuting
INTEGER bFireAlarmMuting
Comments
-
Thats an int being used as a bool. They're using Hungarian notation to indicate it's only meant to be in two states 1(on) or 0(off).
-
Thanks Zack!
-
FYI - any integer over zero will evaluate as true. IE:
IF(nAnInteger){ //Evaluates true if 'nAnInteger' > 0 } ELSE{ //nAnInteger evaluates false if == 0 }
I just put that out there that I often have 'states' stored in integers, with 'Off' being 0, but any other state having an index value. There's a chance that variable started as on or off, but maybe theres a state where the fire alarm was muted but not reset, etc.
The moral is... just because someone named it as a boolean, doesn't mean it' IS a boolean. If you experiencing issues, might be worth checking.
Z -
Ah, makes sense. That's for the explanation. I'm not currently experiencing issues but I will keep this in mind if something comes up.
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums