[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Apr 22 16:33:22 2003 
Subject:Re: Vector arguments to external procedures - correction 
From:Jonathan L Cunningham 
Volume-ID:1030422.01 


<davidy@cogs.susx.ac.uk> wrote in message
b819dt$29dt$1@soapbox.cs.bham.ac.uk">news:b819dt$29dt$1@soapbox.cs.bham.ac.uk...
> Sorry - in my earlier message, instead of
>
> >     int x[100];
> >     foo(*(x+30), 10);
>
> I meant of course
>
>     foo(x+30, 10);
>
> since I want to pass the address, not the value.
>
> The Fortran, by the way, is correct, since Fortran always passes
> addresses.

Irrelevant reminiscence: many years ago, I changed the value of 2 this way.

I had a (Fortran) subroutine which incremented one of its parameters. Later,
I called this subroutine with the constant 2. Later still, I used 2 in an
arithmetic expression: something like,

    ...
    CALL FOO(N, 2, X, Y)
    ...
    J = J + 2
    ...

it took me quite a while to discover that J was being incremented by 3 .....

Ah, those were the days ;-).

Jonathan
(I believe the compiler was "smart" enough to use the same storage for
identical
constants, to save memory.)