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 : ben (at) *nospam* bsb.me.uk (Ben Bacarisse)
Groupes : comp.lang.c
Date : 11. Jul 2024, 00:01:55
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87ikxconq4.fsf@bsb.me.uk>
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.13 (Gnus v5.13)
bart <bc@freeuk.com> writes:

On 10/07/2024 14:32, Ben Bacarisse wrote:
bart <bc@freeuk.com> writes:
 
On 10/07/2024 00:35, Ben Bacarisse wrote:
bart <bc@freeuk.com> writes:
>
On 09/07/2024 18:22, Ben Bacarisse wrote:
bart <bc@freeuk.com> writes:
>
On 09/07/2024 16:58, Ben Bacarisse wrote:
bart <bc@freeuk.com> writes:
>
Arrays are passed by reference:
>
      void F(int a[20]) {}
>
      int main(void) {
        int x[20];
        F(x);
      }
This is the sort of thing that bad tutors say to students so that they
never learn C properly.  All parameter passing in C is by value.  All of
it.  You just have to know (a) what the syntax means and (b) what values
get passed.
>
The end result is that a parameter declared with value-array syntax is
passed using a reference rather than by value.
>
And it does so because the language says, not because the ABI requires
it. A 2-byte array is also passed by reference.
An address value is passed by value.  C has only one parameter passing
mechanism.  You can spin it as much as you like, but C's parameter
passing is simple to understand, provided learner tune out voices like
yours.
>
Little about C's type system is simple.
Parameter passing is relatively simple though since there is only one
mechanism -- pass by value.
>
Except when it comes to arrays.
The oddity is that, in C, one can't pass arrays to functions at all.
That is one of the quirks that people learning C need to learn.  It does
not alter the fact that there is only parameter passing mechanism -- by
value.
Your plan, of course, is to take that one place where C is relatively
simple
>
It is not that simple. It is confusing. It is error prone.

It is simple but you can certainly confuse people by lying about it.  I
agree that it's error prone.  That's why making sure your
misrepresentation is corrected is so important.

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?!"

And I answered that.

I haven't had a reply yet.

Yes you have.  You have even quoted me on the subject in this very
message: "in C, one can't pass arrays to functions at all".

I still consider arrays in C to be 'passed' by a
mechanism which is near-indistinguishable from actual
pass-by-reference.

I don't really care how you consider it, but I do care about how you
misrepresent the facts in public.

In another post you said that your language has pass by reference, and
we also know you have implemented C.  Either you are just very confused
and your language simply has call by value (after all, you think C has
pass by reference), or you know that pass by reference in your language
needs something from the implementation that was not needed when you
implemented C.  I can't decide if you are confused or just lying.

If somebody had proposed adding pass-by-reference for arrays, you'd say C
doesn't need it, because whatever benefits it might have you, C already
has!

I see you are running out of statements to argue against so you have
started to make up your own.  I am sure you have thoroughly refuted this
made up person in your head.

Anyone proposing adding pass-by-reference for arrays would be told (by
me at last) to start by allowing arrays to be passed by value first.
Why anyone would propose adding pass by reference for a type that can't
be currently be passed at all is a mystery that only you (as the
inventor of this person) can know.

--
Ben.

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

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal