Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <87ikxconq4.fsf@bsb.me.uk>
Deutsch   English   Français   Italiano  
<87ikxconq4.fsf@bsb.me.uk>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Ben Bacarisse <ben@bsb.me.uk>
Newsgroups: comp.lang.c
Subject: Re: technology discussion =?utf-8?Q?=E2=86=92?= does the world need
 a "new" C ?
Date: Thu, 11 Jul 2024 00:01:55 +0100
Organization: A noiseless patient Spider
Lines: 97
Message-ID: <87ikxconq4.fsf@bsb.me.uk>
References: <v66eci$2qeee$1@dont-email.me> <v6ard1$3ngh6$4@dont-email.me>
	<v6b0jv$3nnt6$1@dont-email.me>
	<87h6d2uox5.fsf@nosuchdomain.example.com>
	<v6d779$6rk5$2@dont-email.me> <v6e76u$c0i9$1@dont-email.me>
	<v6esqm$fian$2@dont-email.me> <v6f7vg$hgam$1@dont-email.me>
	<20240707164747.258@kylheku.com> <v6gl83$s72a$1@dont-email.me>
	<v6h8ao$ur1v$1@dont-email.me> <v6jhk3$1drd6$1@dont-email.me>
	<v6jiud$1dsjb$1@dont-email.me> <877cdur1z9.fsf@bsb.me.uk>
	<v6joi4$1epoj$1@dont-email.me> <871q42qy33.fsf@bsb.me.uk>
	<v6k6i0$1h4d3$1@dont-email.me> <87ed82p28y.fsf@bsb.me.uk>
	<v6m03l$1tf05$1@dont-email.me> <87r0c1nzjj.fsf@bsb.me.uk>
	<v6m716$1urj4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 11 Jul 2024 01:01:55 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8f0c59e317bc680ad3ae1d9bc8fc08f2";
	logging-data="2212801"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+LPfELp1G41OOOqdtsi1H53FEazNMIqCQ="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:mbL0WD/WnKKMHpRjRi0nqjEsxmQ=
	sha1:XivdqVnU46pCCo5q4BD2OY6UsKg=
X-BSB-Auth: 1.13aae26a43f71e54343b.20240711000155BST.87ikxconq4.fsf@bsb.me.uk
Bytes: 5525

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.