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 : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.c
Date : 13. Jul 2024, 03:39:02
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6spc7$3dlhs$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 23 24 25
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 12.07.2024 15:59, bart wrote:
On 12/07/2024 12:44, Janis Papanagnou wrote:
On 11.07.2024 22:37, bart wrote:
On 11/07/2024 21:29, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
>
This my first comment on the subject:
>
"Arrays are passed by reference:
    ...
Although ..."
>
And that statement was incorrect, even with the "Although".
>
So arrays are passed by value? Gotcha.
>
Neither is true. - Tertium datur!
>
"Array passing" is in "C" realized using a pointer passing
mechanism where the pointer is passed "by value".
>
Neither an array is passed [by value] nor there's a "call
by reference" mechanism in "C".
 
So how are the elements of the caller's array accessed?
 
No copies have been supplied to the caller. So access is by ... ?

...by an implicit pointer value dereferentiation and a global
access to the pointed to storage area.

 
Look, there are only two choices: 'pointer' and 'reference', which in C
are more or less the same thing:

You can create a pointer value using a reference operator '&'.

 
"6.2.5p20 ... A pointer type describes an object whose value provides a
reference to an entity of the referenced type."

It doesn't say anything about a call-by-reference [mechanism]
(as it's for example provided in C++ with  f(int & a) ).

 
So I said 'arrays are passed by reference'; maybe I should have said
'array elements are passed by reference' (which suggests that each has
its own reference), so shoot me.
 
But everyone was so keen to prove me wrong and incapable of understanding.

I think it was (one of) my first post(s) in this thread where
I speculated whether you might use that term just informally.
It seems that my guess was correct, and it would have helped
if you'd have confirmed this (or any of the details you left
unanswered to other posters to show where discrepancies still
are and where consensus has been achieved).

As an end point to the discussion (just for some recreational
reading) I suggest "The Development of the C Language" by D.
Ritchie. It's a honest paper, and contains a Critique section
which incidentally starts by:

"Two ideas are most characteristic of C among languages of
 its class: the relationship between arrays and pointers,
 and the way in which declaration syntax mimics expression
 syntax. They are also among its most frequently criticized
 features, and often serve as stumbling blocks to the beginner.
 [...]
 For example, the empty square brackets in the function
 declaration  int f(a) int a[]; { ... }  are a living fossil,
 a remnant of NB’s way of declaring a pointer; a is, in this
 special case only, interpreted in C as a pointer."


Janis


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