arrays - Fortran 和 Visual Studio 调试中的自动数组长度

标签 arrays visual-studio debugging fortran

我有一个关于调试 fortran 文件的问题。因此我用 d(*) 自动声明了它。然而,在调试和数组监督期间,它只显示相应数组的第一个数字,而不是其他 60 个。
(我使用 Fortran 95 编译器和 Visual Studio 2010)

我怎样才能查看数组的所有变量?

好的,这是代码的一个示例:

ia 是来自主程序的变量整数,取决于某些输入参数。

subroutine abc(ia,a,b,c)
dimension d(*)

a = d(ia+1)
b = d(ia+2)
c = d(ia+3)

return 
end

但是对于调试,了解 d(*) 的端点很有用

最佳答案

我发现这样做的唯一方法是使用 Watch窗口并为数组元素添加监视。假设您的数组名为 d ,然后我发现观察以下表达式会显示数组中的值:

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

当然,对于长度为 60 的数组,如您建议的那样,则表达式
d(61)

将显示该数组地址指向的内存位置中的值。

当然,您真的应该将数组声明为 d(:) .如果这样做,那么 VS 调试器会在通常的 Locals 中显示整个数组。 window 。

关于arrays - Fortran 和 Visual Studio 调试中的自动数组长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13563998/

相关文章:

c - 一个Segfaulting Skip List,一个毁了的周末(C编程)

javascript - MongoDB 查找并修改 : >>> find and update object in document's array

visual-studio - 为什么 MSDN 或 VS2015 不使用 __stdcall 约定声明 IUnknown 方法?

Linux内核远程调试: Can not break back into debugger

visual-studio - XCode是否具有类似于Visual Studio的游标导航堆栈?

c# - Xamarin Android 中多个 Activity 中的抽屉导航

android - wifi调试Android 11设备已配对但Android Studio未检测到

java - 如何将 String 转换为 char 数组?

c# - 包含方法的数组

在 C 中比较两个字符而不使用 ASCII