开发者

Before pointers/refs

So modern lan开发者_如何学Cguages 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?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜