| |||
| Home > Working with the CLI > Macro language > Macro local symbols | |||
You can create symbols in a macro that are local to the macro. You must declare a type for macro local symbols. The type can be any legal C or C++ data type, except const. For example:
define /R int sqrValue(value)
int value;
{
int squared;
squared = value * value;
return squared;
}
.
All symbols declared within a macro exist only during the execution of the macro, that is the static keyword is not recognized.
To create the equivalent of a global static variable, use the ADD command to create the symbol before defining the macro that references the symbol. For example:
add int cnt
define /R counter()
{
cnt = cnt + 1;
}
.
ADD.
the following in the RealView Debugger User Guide: