Path: ...!news.misty.com!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: technology discussion =?utf-8?Q?=E2=86=92?= does the world need a "new" C ? Date: Sat, 17 Aug 2024 07:41:01 -0700 Organization: A noiseless patient Spider Lines: 69 Message-ID: <86jzgfgqki.fsf@linuxsc.com> References: <20240711115418.00001cdf@yahoo.com> <20240712154252.00005c2f@yahoo.com> <86o7717jj1.fsf@linuxsc.com> <20240717163457.000067bb@yahoo.com> <86a5hep45h.fsf@linuxsc.com> <87y14xsvnh.fsf@bsb.me.uk> <87sev5s51s.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sat, 17 Aug 2024 16:41:02 +0200 (CEST) Injection-Info: dont-email.me; posting-host="b051c10d671f0c56e8f10f81bd39f092"; logging-data="2049185"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jNFvau7Xzg0E7Uw9jKskRfUHj+VOFFnc=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:VwDKtw/oXPeLrVmbtdcW0sp9+s0= sha1:WsT+jxKibyMhmg0yQfClKNbuX+4= Bytes: 4362 Bart writes: > On 16/08/2024 01:08, Ben Bacarisse wrote: > >> Bart writes: >> >>> On 15/08/2024 15:33, Ben Bacarisse wrote: >>> >>>> Bart writes: >>>> >>>>> On 15/08/2024 09:43, Tim Rentsch wrote: >>>>> >>>>>> Bart writes: >>>>>> >>>>>> C call-by-value call-by-reference >>>>>> =============== ================= >>>>>> at call: >>>>>> >>>>>> (array argument) F(A) H(A) >>>>>> >>>>>> (pointer argument) F(p) (disallowed) >>>>> >>>>> My posts were about passing *arrays* and the fact that C's pass-by-value >>>>> was remarkably similar to pass-by-reference. >>>> >>>> Which is why, presumably, you didn't show the differences. Your >>>> post was all polemic not part of a collegiate discussion of the >>>> similarities and differences. >>>> >>>>> However your entry for pointers is not correct: >>>> >>>> No, the entry is correct. H(p) would be (is?) disallowed when H's >>>> parameter is a reference to an array. >>> >>> Sorry, what language does the right-hand column pertain to? /Any/ language >>> that has call-by-reference, or Tim's hypthetical language? >> >> Tim said that case was "disallowed". You call that an error on his >> part. What language did you have in mind that permits such a gross >> warping of types? I would describe /any/ language that allowed it as >> having a design error. > > You or he would have to go into more detail, such as an actual > example, to demonstrate whatever it is that you think is wrong about > passing a pointer argument by-reference. > > I assume here that the language in the right column is not C. > >>> Or any that could be used to prove him right? >>> >>> In general there is no reason, in a language with true call-by-reference, >>> why any parameter type T (which has the form U*, a pointer to anything), >>> cannot be passed by reference. It doesn't matter whether U is an array >>> type or not. >> >> I can't unravel this. Take, as a concrete example, C++. You can't pass >> a pointer to function that takes an array passed by reference. You can, >> of course, pass a pointer by reference, but that is neither here nor >> there. > > OK. So why do you agree with this: > >>>>>> C call-by-value call-by-reference >>>>>> =============== ================= >>>>>> (pointer argument) F(p) (disallowed) > > What is 'pointer argument' here? Try thinking harder. Everyone else understood.