Re: technology discussion → does the world need a "new" C ?

Liste des GroupesRevenir à cl c 
Sujet : Re: technology discussion → does the world need a "new" C ?
De : bc (at) *nospam* freeuk.com (Bart)
Groupes : comp.lang.c
Date : 19. Aug 2024, 01:57:22
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v9u59h$2ivqb$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Mozilla Thunderbird
On 19/08/2024 01:01, Ben Bacarisse wrote:
Bart <bc@freeuk.com> writes:
 

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.
 No one has said any such thing, so I can't see how any more detail could
help.  I suspect you've lost track of the point being made.
Probably, and perhaps not just me! But I'd still quite like to know exactly what it is that is marked as 'disallowed'.

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?
 I can't see what is confusing you about this.  I agree with the above
for exactly the reasons I wrote.
Do you mean: 'You can't pass a pointer to a function that takes an array passed by reference'?
(I assume you mean a pointer as argument to a function, rather than a 'pointer to a function'.)
I'd still need to disentangle that via a concrete example (and preferably not C++). With pass-by-reference, that is usually done on top of whatever type choices you've made. Pass-by-reference does not affect those types, but internally there may be extra indirection.
However, as I wrote a day or two ago, if attempting to retrofit pass-by-reference to C, it will interfere a little with normal array-to-pointer decay (since there will be an implicit & applied, that stops that happening).

It would be wrong (and is wrong in
C++) to pass a pointer where an array reference is expected.
Well, putting aside pass-by-reference, that would be wrong in C too, if you interpret 'array reference' to be a type like T(*)[], and a 'pointer' a type like T*.
With pass-by-reference added to C, there would be stronger type checking, so if something is disallowed, it would be for a good reason, not just because Tim said so.

Date Sujet#  Auteur
6 Jul 24 * Re: technology discussion → does the world need a "new" C ?256Lawrence D'Oliveiro
6 Jul 24 +* Re: technology discussion → does the world need a "new" C ?240BGB
6 Jul 24 i+- Re: technology discussion → does the world need a "new" C ?1BGB
6 Jul 24 i+* Re: technology discussion → does the world need a "new" C ?10James Kuyper
9 Jul 24 ii`* Re: technology discussion → does the world need a "new" C ?4David Brown
9 Jul 24 ii `* Re: technology discussion → does the world need a "new" C ?3Michael S
9 Jul 24 ii  +- Re: technology discussion → does the world need a "new" C ?1David Brown
9 Jul 24 ii  `- Re: technology discussion → does the world need a "new" C ?1BGB
6 Jul 24 i`* Re: technology discussion → does the world need a "new" C ?228Keith Thompson
7 Jul 24 i +* Re: technology discussion → does the world need a "new" C ?223BGB
7 Jul 24 i i`* Re: technology discussion → does the world need a "new" C ?222James Kuyper
7 Jul 24 i i `- Re: technology discussion → does the world need a "new" C ?221BGB
10 Jul 24 i `* Re: technology discussion → does the world need a "new" C ?4Lawrence D'Oliveiro
10 Jul 24 i  +- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
10 Jul 24 i  `* Re: technology discussion → does the world need a "new" C ?2James Kuyper
10 Jul 24 i   `- Re: technology discussion → does the world need a "new" C ?1Kaz Kylheku
6 Jul 24 +* Re: technology discussion → does the world need a "new" C ?9James Kuyper
6 Jul 24 i+* Re: technology discussion → does the world need a "new" C ?5bart
10 Jul 24 ii+- Re: technology discussion → does the world need a "new" C ?1Lawrence D'Oliveiro
10 Jul 24 ii+* Re: technology discussion → does the world need a "new" C ?2James Kuyper
10 Jul 24 iii`- Re: technology discussion → does the world need a "new" C ?1bart
12 Aug 24 ii`- Re: technology discussion → does the world need a "new" C ?1Tim Rentsch
6 Jul 24 i`* Re: technology discussion → does the world need a "new" C ?3Keith Thompson
7 Jul 24 i `* Re: technology discussion → does the world need a "new" C ?2James Kuyper
7 Jul 24 i  `- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
6 Jul 24 `* Re: technology discussion → does the world need a "new" C ?6Keith Thompson
10 Jul 24  `* Re: technology discussion → does the world need a "new" C ?5Lawrence D'Oliveiro
10 Jul 24   +- Re: technology discussion → does the world need a "new" C ?1James Kuyper
10 Jul 24   +- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
10 Jul 24   `* Re: technology discussion → does the world need a "new" C ?2Kaz Kylheku
10 Jul 24    `- Re: technology discussion → does the world need a "new" C ?1Ben Bacarisse

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal