views:

35

answers:

2

So modern languages like perl, java, and C pass data around (function parameter for example) via pointers (if written correctly that is), so on the stack when you pass a variable in, the address of that variable is written. I was looking into old versions of fortran, before pointers, and was wondering: How was data passed around before pointers? If I passed in a large array to a subroutine, would that array get written to the stack as opposed to a pointer to the array?

+1  A: 

FORTRAN seemed to assume arguments were passed "as if" by reference.

pascal
+1  A: 

Depends on the implementation, but in one Fortran IV compiler the function is (under the hood) called with a pointer into BSS, where the array lives. That (implementation-dependent) detail is not part of the language syntax and so is missing from the F4 docs.

Pete Wilson