Deutsch   English   Français   Italiano  
<87le0tqoyg.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: Mon, 19 Aug 2024 02:30:15 +0100
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <87le0tqoyg.fsf@bsb.me.uk>
References: <v66eci$2qeee$1@dont-email.me> <v6oct4$2djgq$2@dont-email.me>
	<v6of96$2ekb0$1@dont-email.me> <v6ovfc$2hcpf$1@dont-email.me>
	<v6p4hf$2icph$1@dont-email.me> <v6qgpu$2t6p7$3@dont-email.me>
	<v6r33m$30grj$1@dont-email.me> <20240712154252.00005c2f@yahoo.com>
	<86o7717jj1.fsf@linuxsc.com> <v6ti10$3gru4$1@dont-email.me>
	<v78af7$1qkuf$1@dont-email.me> <20240717163457.000067bb@yahoo.com>
	<v78piu$1su4u$1@dont-email.me> <86a5hep45h.fsf@linuxsc.com>
	<v9ktep$v5sk$1@dont-email.me> <87y14xsvnh.fsf@bsb.me.uk>
	<v9l95b$10ogv$1@dont-email.me> <87sev5s51s.fsf@bsb.me.uk>
	<v9nn5q$1f3op$1@dont-email.me> <87wmkdqt2t.fsf@bsb.me.uk>
	<v9u59h$2ivqb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Mon, 19 Aug 2024 03:30:16 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="153c0803c54c022691c586705843dea6";
	logging-data="2706798"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/cY/wXwlgqx/TQQ4RAjdtv4MHjuEMVrGU="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:fTloH+BV0H1BlXoyELw80MkgRNU=
	sha1:bQweul3HLsL2pU0s5qPEoWRGYmQ=
X-BSB-Auth: 1.ba0b6b9078f6f3de98dd.20240819023015BST.87le0tqoyg.fsf@bsb.me.uk
Bytes: 4120

Bart <bc@freeuk.com> writes:

> On 19/08/2024 01:01, Ben Bacarisse wrote:
>> Bart <bc@freeuk.com> writes:
>> 
>
>>> You or he would have to go into more detail, such as an actual example, to
>>> demonstrate whatever it is that you think is wrong about passing a pointer
>>> argument by-reference.
>> No one has said any such thing, so I can't see how any more detail could
>> help.  I suspect you've lost track of the point being made.
>
> Probably, and perhaps not just me! But I'd still quite like to know exactly
> what it is that is marked as 'disallowed'.

I don't know how to explain it any better.  If you really want to know,
maybe you could say what /you/ think was incorrectly marked as
disallowed so I can see how you were interpreting the table.  You
obviously had something in mind or you could not have said Tim was
wrong.

>>>> I can't unravel this.  Take, as a concrete example, C++.  You can't pass
>>>> a pointer to function that takes an array passed by reference.  You can,
>>>> of course, pass a pointer by reference, but that is neither here nor
>>>> there.
>>>
>>> OK. So why do you agree with this:
>>>
>>>>>>>>                             C call-by-value         call-by-reference
>>>>>>>>                             ===============         =================
>>>>>>>>         (pointer argument)  F(p)                    (disallowed)
>>>
>>> What is 'pointer argument' here?
>> I can't see what is confusing you about this.  I agree with the above
>> for exactly the reasons I wrote.
>
> Do you mean: 'You can't pass a pointer to a function that takes an array
> passed by reference'?

Yes.  As you say below, there would be a good reason not to allow that
in a C-like language with call-by reference added.

>> It would be wrong (and is wrong in
>> C++) to pass a pointer where an array reference is expected.
>
> Well, putting aside pass-by-reference, that would be wrong in C too, if you
> interpret 'array reference' to be a type like T(*)[], and a 'pointer' a
> type like T*.

I'm not sure what this true remark adds.  Everything that is in
discussion relates to call-by-reference where that clearly does not just
mean "passing a pointer".

> With pass-by-reference added to C, there would be stronger type checking,
> so if something is disallowed, it would be for a good reason, not just
> because Tim said so.

Or maybe, just maybe, Tim said it for good reason.

-- 
Ben.