Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

arrays + watch window

1 view
Skip to first unread message

Yiorgos Lykidis

unread,
Aug 13, 2002, 2:04:10 PM8/13/02
to

Is there a way to display all the elements of an array which have been
defined with a dimension A(*) (dimension is assumed known from a previous
subroutine)? If someone types the name of the matrix in the watch window
only the first element is shown...! Why is that?

Thanx,
Yiorgox


Michel OLAGNON

unread,
Aug 14, 2002, 2:47:06 AM8/14/02
to

Just because assuming that size is known is wrong. A(*) means that actual
size in the calling routine doesn't matter to the system, because
the programmer is supposed to be able to know it by some other means.


--
Michel OLAGNON email : Michel....@ifremer.fr
http://www.ifremer.fr/metocean/group/michel/michel_olagnon.htm
http://www.fortran-2000.com/


Michael Sabielny

unread,
Aug 14, 2002, 2:56:28 AM8/14/02
to
Yiorgos Lykidis wrote:

Because the debugger has no information of the length of the array you are
watching. A(*) ia an assumed size array. Try to modify your routine like
this:

old:
subroutine foo(arr)
implicit none
integer,dimension(*) :: arr

<more code>
end

new:
subroutine foo(dim,arr)
implicit none
integer :: dim
integer,dimension(dim) :: arr

<more code>
end

The new routine passes the length of arr to the subroutine. The debugger now
can display all elements.

Greetings,
Michael
--
Dipl.-Ing. Michael Sabielny
Technical University of Hamburg-Harburg
Department of Theoretical Electrical Engineering
D-21071 Hamburg
Germany

Yiorgos Lykidis

unread,
Aug 14, 2002, 5:37:02 AM8/14/02
to
> Because the debugger has no information of the length of the array you are
> watching. A(*) ia an assumed size array. Try to modify your routine like
> this:
>
> old:
> subroutine foo(arr)
> implicit none
> integer,dimension(*) :: arr
>
> <more code>
> end
>
> new:
> subroutine foo(dim,arr)
> implicit none
> integer :: dim
> integer,dimension(dim) :: arr
>
> <more code>
> end
>
> The new routine passes the length of arr to the subroutine. The debugger
now
> can display all elements.

Apart from the fact that I will be able to see all the elements in the watch
window, would this kind of approach be more efficient programming than what
I have been doing (dim A(*))???

Yiorgos


Patrick

unread,
Aug 14, 2002, 6:04:00 AM8/14/02
to
"Yiorgos Lykidis" <lyk...@hotmail.com> wrote in message news:<ajbhne$2uod$1...@ulysses.noc.ntua.gr>...


DIMENSION A(*) does not mean that the program knows the size of the
array. It just means that A is an array, and that the programmer will
have to pay attention to respect the size. The debugger has no
information of the size of A.

For debugging, you can try typing A(1:100), or A(1:something),
depending on how many elements you want to see. I know this works in
CVF, I don't know for other debuggers.

Hope this helps
Pat

0 new messages