PSS ID Number: 149747
Article Last Modified on 11/3/1999
The information in this article applies to:
- Microsoft Fortran PowerStation for Windows 95 and Windows NT 4.0
This article was previously published under Q149747
SYMPTOMS
The debugger's watch window cannot evaluate expressions that contain named constants that have gone out of scope. Attempting to use a variable evaluation expression containing a locally undefined named constant in one of the watch windows causes the message "EE2347: Undefined variable" to be returned in the corresponding value field.
STATUS
This behavior is by design.
MORE INFORMATION
The scope context operator allows you to view information about module variables that have gone out of scope. However, using the scope context operator in this manner does not apply to named constants. You cannot use the scope context operator to evaluate named constants.
Steps to Illustrate Behavior
- Build the sample code provided in Developer Studio.
- After successfully building the sample code, start a debugging session by selecting Debug from the Build menu and then choosing Step Into.
- Step into the module subroutine MODULE_PROC. In a watch window, type:
MY_MODULE::MODULE_PROC::Y
- Step into the internal module subroutine INTERNAL_PROC to the assignment statement of variable N. Note that the watch expression created in Step 3 is no longer valid because it references the named constant Y which is out of scope.
- In the subroutine INTERNAL_PROC, evaluate the variables H and N and the named constant Y. In a watch window, do the following:
To evaluate H using the scope context operator, type:{MY_MODULE::MODULE_PROC::INTERNAL_PROC}H
To evaluate N using the scope context operator, type:
{MY_MODULE::MODULE_PROC::INTERNAL_PROC}N
Evaluation of Y will fail when out of scope or when using the scope context operator.
Using the scope context operator, type:{MY_MODULE::MODULE_PROC::INTERNAL_PROC}Y
-or-
Without the scope context operator, type:MY_MODULE::MODULE_PROC::INTERNAL_PROC::Y
NOTE: "EE2347: Undefined variable" is generated for the named constant Y. The value of the named constant Y can only be viewed while control is in the MODULE_PROC subroutine.
Sample Code
! Compile options needed: /Zi MODULE MY_MODULE INTEGER H CONTAINS SUBROUTINE MODULE_PROC PARAMETER(Y=9.0) CALL INTERNAL_PROC CONTAINS SUBROUTINE INTERNAL_PROC INTEGER N N = Y + H END SUBROUTINE INTERNAL_PROC END SUBROUTINE MODULE_PROC END MODULE MY_MODULE PROGRAM TEST USE MY_MODULE CALL MODULE_PROC END PROGRAM TEST
Additional query words: 4.00
Keywords: kbLangFortran KB149747
Technology: kbAudDeveloper kbFORTRANPower400NT kbFortranSearch kbZNotKeyword8