[TUHS] C declarations.

Steve Nickolas usotsuki at buric.co
Mon May 15 00:58:18 AEST 2017


On Sun, 14 May 2017, Doug McIlroy wrote:

>> Are there languages that copy arrays in function calls defaultly?
>
>> Pascal is an example.
>
> Pascal's var convention, where the distinction between value
> and reference is made once and for all for each argument of
> each function, is sound. The flexibility of PL/I, where the
> distinction is made at every call (parenthesize the name to
> pass an array by value) is finicky, though utterly general.

QuickBasic uses the ( ) trick too.

>> Where is all that [memory]  going to come from if you pass a
>> large array on a memory-constrained system of specs common back in the
>> days when C was designed
>
> Amusingly, under the customary linkage method in the even earlier
> days when Fortran was designed, pass-by-reference entailed a big
> overhead that could easily dominate pass-by-value for small arrays.
>
> [In the beginning, when CPUs had only one register, subroutine
> preambles plugged the reference into every mention of that variable
> throughout the body of the subroutine. This convention persisted
> in Fortran, which was designed for a machine with three index
> registered. Since reference variables were sometimes necessary
> (think of swap(a,b) for example) they were made standard.]
>
> Doug
>

Three! O_O That's a lot, if you're used to the 6502 and its mere *two* 
index registers.

-uso.



More information about the TUHS mailing list