Variable Naming Standards
- Last UpdatedJul 18, 2023
- 1 minute read
The following naming conventions should be applied to variables:
-
Variable names should have a small case letter prefix as follows:
|
Type |
Prefix |
Used for |
|
INT (32 bits) |
i |
index, loop counter |
|
INT (32 bits) and OBJECT (32 bits) |
h |
handle |
|
INT (32 bits) |
b |
boolean (TRUE/FALSE) |
|
REAL (64 bits) |
r |
real type variables |
|
STRING (255 bytes) |
s |
string type variables |
-
Variable names typically consist of up to three words. Each word in a variable name should start with a capital letter, for example:
iTrendType, rPeriod, sFileName
-
Module variable names should be prefixed with an "m", for example:
miTrendType, mrPeriod, msFileName
-
Global variable names should be prefixed with a "g", for example:
giTrendType, grPeriod, gsFileName
-
Local variable names should not be prefixed (when you declare a variable without specifying the scope, it is considered a Local variable by default):
iTrendType, rPeriod, sFileName