Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: dave_thompson_2@comcast.net Newsgroups: comp.lang.c Subject: Re: technology discussion ? does the world need a "new" C ? Date: Sun, 25 Aug 2024 17:16:04 -0400 Organization: A noiseless patient Spider Lines: 41 Message-ID: <2i7ncj9n2h0kfrfd610jght8k692mdmv04@4ax.com> References: <87r0c1nzjj.fsf@bsb.me.uk> <87ikxconq4.fsf@bsb.me.uk> <20240711115418.00001cdf@yahoo.com> <20240712045301.394@kylheku.com> <87sewesg89.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Date: Sun, 25 Aug 2024 23:16:17 +0200 (CEST) Injection-Info: dont-email.me; posting-host="09f9e4e3fd1f3f0a9b1d8559f78a3163"; logging-data="2206004"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0+zMQFxWt9/VgSfmHyvNZGMf1nmBlkDM=" Cancel-Lock: sha1:TVVwStAsGKUVxPoP8/kqFTtcrzo= X-Newsreader: Forte Agent 3.3/32.846 Bytes: 3420 On Fri, 12 Jul 2024 09:54:46 -0700, Keith Thompson wrote: [snip] > I know that "call by reference" is the usual formal term, but I > personally prefer "pass by reference". > > The terms "call by reference" and "call by value" emphasize the call, > implying that all arguments in a given call are passed with the same > mechanism. In some languages that's true (C argument passing is purely > by value, and Fortran, as I understand it, is purely by reference), but Nope. Since 1990 Fortran supports several options for argument passing -- optionally including some that provide interoperability with (at least one implementation of) C! -- but even taking 'classic' FORTRAN either reference or copyin-copyout was allowed, and important compilers (like IBM) were known to use both. Until c.l.f recently lapsed into desuetude, this was a FAQ -- "this dusty-deck code doesn't work as I expected on the basis that FORTRAN used to be by-ref" -> "you expected wrong". OTOH COBOL did make everything by-reference, at least up to 1985. And I believe PL/I, but I didn't get deeply into that. FORTH, like C, was always by-value where the value could be an address -- with no target type information (like C void*). > in others (C++, Pascal, Ada) you can select by-value or by-reference for > each parameter. "Pass by (reference|value)" feels more precise. > C++ and Pascal -- and algol68 -- yes. Ada no, or not standardly; it specifies a few types that must be by-value and a few more that must be by-reference (mostly ones that can't be copied safely, or at all), and for everything else lets the compiler choose. I'm unsure if the standard allows extension(s) about this, but even if so I doubt it would be popular with Ada users (demotivating implementors). > I haven't checked, but I suspect the terms "call by (reference|value)" > predate languages that allowed the mechanism to be specified for each > parameter. Definitely.