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 : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.c
Date : 11. Jul 2024, 20:56:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6pdcf$2jijk$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 11/07/2024 19:53, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
[...]
For that purpose, in the mind of the user, it does the same job as 'by
by reference'. That it does so by some other quirks (array decay, and
the ability to index pointers as thought they were arrays), is by the
by.
[...]
 Those "quirks" are a rich source of confusion and bugs for anyone who
doesn't understand how this stuff is actually defined.  (Yes, I'm
acknowledging, yet again, that the way C specifies its treatment of
arrays is confusing.)
 A user who thinks that arrays are simply "passed by reference" is likely
to try to apply sizeof to an array parameter (and might or might not get
a diagnostic from the compiler).  A slightly more sophisticated user is
still likely to be unsure of just where the "quirks" are.
 What have you ever done to help make that kind of error less likely?
What is your goal?
This my first comment on the subject:
"Arrays are passed by reference:
   ...
Although ..."
(Note that 'Although'.) And the first reply was:
BB:
"All parameter passing in C is by value.  All of it."
And there's been no let up since then.
Nobody has acknowledged that there's more going on with passing array types than it simply being due to 'pass by value', if it's not full 'pass by reference'.
The language could have helped a little by making this invalid:
    int A[20];
    void F(int B[20]) {}
The type of B looks just like that of A, but it isn't; the T[N] type is silently changed to T*. The language could insist that you write:
    void F(int* B) {}
This way, it is far clearer that a pointer is being passed, and 'pass by value' now makes more sense. The way B will be used is now consistent with the same declaration anywhere else.
My goals might be to make the language a little more accessible, although that cuts little ice here where most are C experts of long standing; they won't know or will have forgotten what it's like to be a beginner or outsider, or coming to C from saner languages.
However I use /my/ saner language every day.

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