From mboxrd@z Thu Jan 1 00:00:00 1970 From: dfawcus+lists-tuhs@employees.org (Derek Fawcus) Date: Sun, 14 May 2017 14:14:44 +0100 Subject: [TUHS] C declarations. In-Reply-To: <1494702324.1901172.975588504.1BA76452@webmail.messagingengine.com> References: <015401d2caa0$79762650$6c6272f0$@ronnatalie.com> <68E8DC0A-D1B8-4FF0-AD26-ACDC57E308AF@pobox.com> <20170511223232.GM4341@mcvoy.com> <015b01d2caa7$c658c020$530a4060$@ronnatalie.com> <20170513012415.GZ4341@mcvoy.com> <025701d2cb92$ec8182a0$c58487e0$@ronnatalie.com> <20170513122050.GF9980@yeono.kjorling.se> <1494702324.1901172.975588504.1BA76452@webmail.messagingengine.com> Message-ID: <20170514131444.GB81508@cowbell.employees.org> On Sat, May 13, 2017 at 03:05:24PM -0400, Random832 wrote: > On Sat, May 13, 2017, at 08:20, Michael Kjörling 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. > > If that were the issue, the callee could simply automatically make the > copy if-and-only-if it needs it. I recall reading a proposed ABI for C on MIPS which would have done something similar for passing structs by value, namely pass a pointer but allocate local storage space in the callee. If the callee ever assigned to the passed struct, it was to copy the actual values, then update its pointer. I don't think that ABI was ever implemented. DF