Auto array length in Fortran and Visual Studio debug

I have a question regarding debugging a fortran file. So I declared this with d (*) automatically. However, during debugging and control of the array, it shows only the first number of the corresponding array, and not 60 others. (I use the Fortran 95 compiler and Visual Studio 2010)

How can I view all array variables?


Ok, here is a sample code:

ia is a variable integer from the main procedure, depending on some input parameters.

subroutine abc(ia,a,b,c) dimension d(*) a = d(ia+1) b = d(ia+2) c = d(ia+3) return end 

However, for debugging it is useful to know the extremities d (*)

+6
source share
1 answer

The only way I found this is to use the Watch window and add a clock for the elements of the array. Suppose your array is called d , then I found that looking at the following expressions shows the values ​​in the array:

 d(2) ! which just shows the 2nd element in the array d(1:10) ! which shows the first 10 elements of the array d(1:12:2) ! which shows the odd numbered elements of the array from 1 to 11 

And of course, for the array of length 60 that you suggest, there is an expression

 d(61) 

will show you what value is in the memory location pointed to by the address of this array.

Of course you should really declare your array as d(:) . If you do this, the VS debugger will display the entire array in a regular Locals window.

+1
source

All Articles