Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28592 Discussions

Visual debugging of #define variable

Daniel_E_1
Beginner
373 Views

I have a line like this:

STRUCT(2)%VAR = 1

I use fpp to make the code a little more readable with

#define VAR  STRUCT(2)%VAR

and now the code is

VAR = 1

The preprocessor expands this to the full line and everything works fine.

However, when I am debugging, I can no longer hold the cursor over "VAR" and see the value in a popup, nor can I put "VAR" in a watch window.  Is there a way to have the debugger know about expanding "VAR" like the preprocessor does?

0 Kudos
1 Reply
Steven_L_Intel1
Employee
373 Views

No. Preprocessing is simply a textual substitution that occurs before the compiler is run. There is no way to inform the debugger about it.

You might want to look into the ASSOCIATE construct for this purpose. For example:

associate (VAR => STRUCT(2)%VAR)
  VAR = 1
  ...
end associate

The debugger can see VAR in this case.

0 Kudos
Reply