The scope prefix indicates the scope of variables and constants. It indicates whether it is a local or global variable, or a constant.
Global variables are indicated by a capital G_ and a property prefix c is added to global constants (followed by an underscore in each case).
NOTE: Additionally identify the global variables and constants of libraries with the namespace of the library.
Scope Prefix |
Type |
Use |
Example |
---|---|---|---|
no prefix |
VAR |
local variable |
xEnable |
G_ |
VAR_GLOBAL |
global variable |
G_diFirstUserFault |
Gc_ |
VAR_GLOBAL CONSTANT |
global constant |
Gc_dwErrorCode |
VAR_GLOBAL CONSTANT
Gc_dwExample : DWORD := 16#0000001A;
END_VAR
Access to the global variable of a library with the namespace INF:
INF.G_dwExample := 16#0000001A;