[TUHS] C declarations.
tfb at tfeb.org
Sat May 13 22:35:49 AEST 2017
On 13 May 2017, at 13:20, Michael Kjörling <michael at kjorling.se> wrote:
> Correct me if I am wrong, but _pass by value_ as opposed to _pass by
> reference_ requires making a copy, no? That's the whole point, to
> allow the callee to poke at the value it is given at will. At the very
> least, it would require making a copy when a part of the passed value
> is modified. Where is that memory going to come from, when even
> malloc() isn't a part of the language but rather a part of the
> standard library? Where is all that 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, especially one that lacks virtual memory
Are there languages that copy arrays in function calls defaultly? Perhaps Fortran has some convention that allows that but I doubt it gets used very much, because it would be insane in most cases: COMPUTE_MEAN_TEMPERATURE(ATMOS) is really *not* going to work very well if it involves copying the ATMOS array.
More information about the TUHS