Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Definiciones de VARIABLES PUBLICAS en FWH 7.12
Posted: Thu Jun 26, 2008 07:28 AM
Jose Luis,
MEMVAR no declara una variable, sino que le especifica al compilador que determinados s铆mbolos son variables de memoria (declarados en alguna parte) y que no son "campos".
En principio tu c贸digo deberia seguir compilando correctamente, salvo que haya un error en el compilador.
De la documentaci贸n de Clipper:
MEMVAR is a declaration statement that causes the compiler to resolve
references to variables specified without an explicit alias by
implicitly assuming the memory variable alias (MEMVAR->). Only
explicit, unaliased references to the specified variables are affected.
MEMVAR, like all declaration statements, has no effect on references
made within macro expressions or variables.
The MEMVAR statement neither creates the variables nor verifies their
existence. Its primary effect is to ensure correct references to
variables whose existence is known to be guaranteed at runtime. At
runtime, the specified variables must be created using the PRIVATE,
PARAMETERS or PUBLIC statements. This can occur in the procedure
containing the MEMVAR declaration or in a higher-level procedure.
Attempting to access the variables before they are created will cause an error.
The scope of the MEMVAR declaration is the procedure or function in
which it occurs, or the entire source file if it precedes any PROCEDURE
or FUNCTION statements and the /N compiler option is used. The /N
option suppresses automatic definition of a procedure with the same name
as the program (.prg) file.
Like other declaration statements, MEMVAR must precede any executable statements including PARAMETERS, PUBLIC, and PRIVATE statements in a procedure or function definition; or the program (.prg) file if the declaration has filewide scope.
MEMVAR can be used in conjunction with the /W compiler option--which
generates warning messages for ambiguous variable references--to perform compile-time checking for undeclared variables.