Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #387607
| From | Ben Bacarisse <ben@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: technology discussion → does the world need a "new" C ? |
| Date | 2024-08-16 11:17 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87ed6osreg.fsf@bsb.me.uk> (permalink) |
| References | (16 earlier) <v9ktep$v5sk$1@dont-email.me> <87y14xsvnh.fsf@bsb.me.uk> <v9l95b$10ogv$1@dont-email.me> <87sev5s51s.fsf@bsb.me.uk> <20240816121015.0000579b@yahoo.com> |
Michael S <already5chosen@yahoo.com> writes: > On Fri, 16 Aug 2024 01:08:15 +0100 > Ben Bacarisse <ben@bsb.me.uk> wrote: > >> Bart <bc@freeuk.com> writes: >> >> > On 15/08/2024 15:33, Ben Bacarisse wrote: >> >> Bart <bc@freeuk.com> writes: >> >> >> >>> On 15/08/2024 09:43, Tim Rentsch wrote: >> >>>> Bart <bc@freeuk.com> 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. >> >> > 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. > > IMHO, C++ is a particularly bad example. It's a bad example of a programming language, but that is exactly why it's a good example of something very like C but with a reference mechanism. > Yes, C++ has call-by-reference misfeature. But arrays in C++ are > 2nd class citizen, same as in C. They can't be assigned and can't be > passed to callee, neither by value nor by reference. See my reply to David. If it has call-by-reference at all (and I agree that passing reference values is a better way to think about this) then why do say that arrays can't be passed by reference? I'd say either that nothing can (it's all just passing reference values) or arrays /can/ indeed be "passed by reference" just like, say, int objects. > Also, I suspect that if you ask Ken Thompson, he will tell you that C++ > does not really have 'call by reference'. Instead, it has references as > 1st class object, so, naturally, values of references can be used > during 'call by value'. I used to teach C++, and the only way to avoid a class full of puzzled students is to avoid taking about "by reference" and "by value": all argument passing is like local variable initialisation. In essence, everything is still passed by value. So I agree with the general idea, but I would not say that references are first class values, and reference objects are certainly not first class objects (for example, you can't pass one "by reference"!). > I have enough of respect to KT to consider that his POV is not a > nonsense. > -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
Re: technology discussion → does the world need a "new" C ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-07-13 02:01 -0700
Re: technology discussion → does the world need a "new" C ? BGB <cr88192@gmail.com> - 2024-07-13 04:39 -0500
Re: technology discussion → does the world need a "new" C ? Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-07-13 12:35 +0200
Re: technology discussion → does the world need a "new" C ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-07-13 14:43 -0700
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-07-17 12:38 +0100
Re: technology discussion → does the world need a "new" C ? Michael S <already5chosen@yahoo.com> - 2024-07-17 16:34 +0300
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-07-17 16:56 +0100
Re: technology discussion → does the world need a "new" C ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-15 01:43 -0700
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-15 13:48 +0100
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-08-15 15:33 +0100
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-15 17:08 +0100
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-08-16 01:08 +0100
Re: technology discussion → does the world need a "new" C ? Michael S <already5chosen@yahoo.com> - 2024-08-16 12:10 +0300
Re: technology discussion → does the world need a "new" C ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-16 02:18 -0700
Re: technology discussion → does the world need a "new" C ? Michael S <already5chosen@yahoo.com> - 2024-08-16 12:38 +0300
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-16 12:28 +0100
Re: technology discussion → does the world need a "new" C ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-16 11:40 -0700
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-08-16 11:17 +0100
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-08-16 11:42 +0200
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-08-16 11:00 +0100
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-08-16 16:31 +0200
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-08-19 00:54 +0100
Re: technology discussion → does the world need a "new" C ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-18 18:03 -0700
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-08-19 09:26 +0200
Re: technology discussion → does the world need a "new" C ? Michael S <already5chosen@yahoo.com> - 2024-08-19 12:22 +0300
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-08-19 14:14 +0100
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-08-19 21:18 +0200
Re: technology discussion → does the world need a "new" C ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-16 10:56 -0700
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-08-17 12:26 +0200
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-17 11:38 +0100
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-16 15:19 +0100
Re: technology discussion → does the world need a "new" C ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-17 07:41 -0700
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-17 18:07 +0100
Re: technology discussion → does the world need a "new" C ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-17 18:22 -0700
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-18 12:35 +0100
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-08-19 01:01 +0100
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-19 01:57 +0100
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-08-19 02:30 +0100
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-19 12:29 +0100
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-08-20 00:33 +0100
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-20 12:42 +0100
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-08-16 10:04 +0200
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-16 12:45 +0100
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-08-16 16:51 +0200
Re: technology discussion → does the world need a "new" C ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-08-15 14:36 -0700
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-15 23:22 +0100
Re: technology discussion → does the world need a "new" C ? Kaz Kylheku <643-408-1753@kylheku.com> - 2024-08-15 23:29 +0000
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-16 01:46 +0100
Re: technology discussion → does the world need a "new" C ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-15 18:21 -0700
Re: technology discussion → does the world need a "new" C ? tTh <tth@none.invalid> - 2024-08-16 03:37 +0200
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-08-16 12:14 +0100
Re: technology discussion → does the world need a "new" C ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-15 14:52 -0700
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-07-17 19:07 +0200
Re: technology discussion → does the world need a "new" C ? BGB <cr88192@gmail.com> - 2024-07-17 12:53 -0500
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-07-18 09:46 +0200
Re: technology discussion → does the world need a "new" C ? BGB <cr88192@gmail.com> - 2024-07-18 05:05 -0500
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-07-18 14:41 +0200
Re: technology discussion → does the world need a "new" C ? Bart <bc@freeuk.com> - 2024-07-18 14:00 +0100
Re: technology discussion → does the world need a "new" C ? David Brown <david.brown@hesbynett.no> - 2024-07-18 18:01 +0200
Re: technology discussion → does the world need a "new" C ? BGB <cr88192@gmail.com> - 2024-07-18 14:25 -0500
Re: technology discussion → does the world need a "new" C ? vallor <vallor@cultnix.org> - 2024-07-18 22:23 +0000
Re: technology discussion → does the world need a "new" C ? BGB <cr88192@gmail.com> - 2024-07-18 12:40 -0500
Re: technology discussion → does the world need a "new" C ? Ben Bacarisse <ben@bsb.me.uk> - 2024-07-13 13:35 +0100
Re: technology discussion → does the world need a "new" C ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-07-17 01:09 -0700
csiph-web