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

Liste des GroupesRevenir à l c 
Sujet : Re: technology discussion → does the world need a "new" C ?
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.c
Date : 11. Jul 2024, 12:49:03
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <865xtc87yo.fsf@linuxsc.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
bart <bc@freeuk.com> writes:

On 10/07/2024 19:39, Michael S wrote:
>
On Wed, 10 Jul 2024 18:30:54 +0100
bart <bc@freeuk.com> wrote:
>
On 10/07/2024 16:48, Tim Rentsch wrote:
>
bart <bc@freeuk.com> writes:
   >>>> I earlier asked this:
>
"So if arrays aren't passed by value in C, and they aren't passed
by reference, then how the hell ARE they passed?!"
>
They aren't.  C allows lots of things to be passed as an argument
to a function:  several varieties of numeric values, structs,
unions, and pointers, including both pointers to object types and
pointers to function types.  C does not have a way for a function
to take an argument that is either an array or a function.  There
is a way to take pointers to those things, but not the things
themselves.  Arrays and functions are second-class values in C.
>
That's a good point.  It's not just arrays that can't be passed by
value (because the language says so) but also functions (because its
not meaningful).
>
Yet, although pointers to arrays and function can be passed (without
even doing anything special like using &), you are not allowed to say
that anything is passed by reference in C!
>
The automatic conversion to a pointer, which is also a feature of
true pass-by-reference, doesn't count.
>
Not needing an explicit deref inside the callee (another
characteristic of pass-by-reference) doesn't count either.
>
It does not count, because automatic conversion to a pointer is not
something that happens only during parameter passing.  For arrays, it
happens in all contexts except sizeof().  For functions, it happens in
all contexts except function call.  Or, may be, including function call,
in this case (but not in case of arrays) it depends on point of view.
>
Suppose that was to happen in all contexts, not just for arrays and
functions, but for all types.
>
That means that if A, B, C were numbers, then any call such as F(A, B,
C) would pass the addresses of the numbers rather than their values.
>
According to what people have said, C would STILL be a language that
passed thing by value, and never by automatic reference.

First, the scheme that you outline is either dumb or disingenuous
(or perhaps both).

Second, the argument you're making is purely ad hominem:  it
isn't about what is true but about what it is people will say, or
at least what you think they would say.

Third, none of this changes the underlying reality.  Whatever
people might say about your hypothetical scenario, or whatever it
is you think they would say, it doesn't alter the fact that in C
all function arguments are passed by value, and not by reference.

Date Sujet#  Auteur
5 Jul 24 * Re: technology discussion → does the world need a "new" C ?306Lawrence D'Oliveiro
5 Jul 24 `* Re: technology discussion → does the world need a "new" C ?305BGB
5 Jul 24  +* Re: technology discussion → does the world need a "new" C ?2Lawrence D'Oliveiro
5 Jul 24  i`- Re: technology discussion → does the world need a "new" C ?1yeti
5 Jul 24  +* Re: technology discussion → does the world need a "new" C ?275Keith Thompson
5 Jul 24  i+- Re: technology discussion → does the world need a "new" C ?1Lawrence D'Oliveiro
15 Jul 25  i`- 
5 Jul 24  +* Re: technology discussion → does the world need a "new" C ?26bart
5 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 ?24Lawrence D'Oliveiro
6 Jul 24  i +* Re: technology discussion → does the world need a "new" C ?17Keith Thompson
6 Jul 24  i i+- Re: technology discussion → does the world need a "new" C ?1Janis Papanagnou
6 Jul 24  i i`* Re: technology discussion → does the world need a "new" C ?15Lawrence D'Oliveiro
6 Jul 24  i i +- Re: technology discussion → does the world need a "new" C ?1Ben Bacarisse
6 Jul 24  i i +- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
7 Jul 24  i i +* Re: technology discussion → does the world need a "new" C ?10James Kuyper
10 Jul 24  i i i`* Re: technology discussion → does the world need a "new" C ?9Lawrence D'Oliveiro
10 Jul 24  i i i `* Re: technology discussion → does the world need a "new" C ?8James Kuyper
11 Jul 24  i i i  `* Re: technology discussion → does the world need a "new" C ?7Lawrence D'Oliveiro
11 Jul 24  i i i   +* Re: technology discussion → does the world need a "new" C ?2David Brown
11 Jul 24  i i i   i`- Re: technology discussion → does the world need a "new" C ?1Malcolm McLean
11 Jul 24  i i i   +* Re: technology discussion → does the world need a "new" C ?3bart
11 Jul 24  i i i   i`* Re: technology discussion → does the world need a "new" C ?2Chris M. Thomasson
12 Jul 24  i i i   i `- Re: technology discussion → does the world need a "new" C ?1Chris M. Thomasson
11 Jul 24  i i i   `- Re: technology discussion → does the world need a "new" C ?1James Kuyper
7 Jul 24  i i +- Re: technology discussion → does the world need a "new" C ?1Tim Rentsch
25 Aug 24  i i `- Re: technology discussion ? does the world need a "new" C ?1dave thompson 2
6 Jul 24  i +- Re: technology discussion → does the world need a "new" C ?1Janis Papanagnou
6 Jul 24  i +- Re: technology discussion → does the world need a "new" C ?1James Kuyper
6 Jul 24  i `* Re: technology discussion → does the world need a "new" C ?4bart
7 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 ?2bart
7 Jul 24  i    `- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
5 Jul 24  `- Re: technology discussion → does the world need a "new" C ?1lexi hale

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal