Statement MEMVAR Foundation
Declares variables of the storage class PRIVATE or PUBLIC.
The MEMVAR statement declares variables for the compiler as dynamic memory variables. Such variables belong to the storage class PRIVATE or PUBLIC, and are generated at runtime. With MEMVAR, the compiler can resolve references for variables which were neither declared as LOCAL or STATIC nor are preceded by an alias name and alias operator. The variables in the list <MemvarName,...> are implicitly aliased with MEMVAR->, the alias for dynamic memory variables. MEMVAR only applies to variables which are referenced at compile time and not at runtime with the macro operator (&).
The maximum length of a variable name in the list <MemvarName,...> is not limited, but only the first 255 characters are significant. Variables names must consist of alphanumeric characters and the first character cannot be numeric. The underscore (_) is permitted as a special character.
The MEMVAR statement must precede any executable statements in the functions or procedures in which it is used. Its scope is the function or procedure in which it occurs. When the MEMVAR statement occurs at the beginning of the file, prior to any executable statement, its scope is the entire PRG file. It serves exclusively for the declaration of variables and does not create them or verify their existence. The variables are created by the statement PARAMETERS, PRIVATE or PUBLIC. A runtime error occurs if a MEMVAR is referenced prior to being created.
The MEMVAR statement serves for the correct compile time referencing of variables that do not have alias identifiers, and that are not declared as LOCAL, STATIC or as field variables. The /W compiler switch will cause warnings about ambiguous variables to be displayed during compilation.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.