This compiler warning means that, at the line where it occurs, the value of a global variable is used that may not have been initialized.
For example:
global
nCounter
var
begin
nCounter = nCounter + 1
end
To address the conditions that lead to this warning, make sure that any path of execution through your macro either assigns a value to the global variable, or verifies successfully that it was initialized previously.
Below is a snippet that does this:
if IsInitialized(nCounter)
// successfull call branch
// do whatever you want, nCounter is already initialized
else
// un-successfull call branch
// but we assign a value to nCounter, so NO warning
nCounter = 0
endif
nCounter = nCounter + 1
The difference between this message about global variables and the corresponding message for normal variables is that for global variables, the compiler checks that either the variable was assigned a value before reaching a particular line of code, or that a successful call to the function IsInitialized guarantees that the global variable was initialized in a previous iteration of the macro.
This message can also occur when your code has a branch before a line that refers to a global variable.
global
nCounter
var
bIsFirstPage
begin
if n_OutputPage mod 2 == 0
bIsFirstPage = IsInitialized(nCounter)
endif
nCounter = nCounter + 1 // what happens if n_OutputPage mod 2 <> 0 ?
end
See also: variable is not initialized.
Topic 109026, last updated on 18-Apr-2020