
Vector arguments to external procedures - correction
Quote:
> 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.)