Deutsch   English   Français   Italiano  
<v6me1p$205a8$1@dont-email.me>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: =?UTF-8?Q?Re=3A_technology_discussion_=E2=86=92_does_the_world_need?=
 =?UTF-8?B?IGEgIm5ldyIgQyA/?=
Date: Wed, 10 Jul 2024 17:48:57 +0100
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <v6me1p$205a8$1@dont-email.me>
References: <v66eci$2qeee$1@dont-email.me> <v68dsm$37sg2$1@dont-email.me>
 <87wmlzvfqp.fsf@nosuchdomain.example.com> <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> <v6mas4$1v1rh$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 10 Jul 2024 18:48:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ded9e1848a26cfa2c70264cde0490f0f";
	logging-data="2102600"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18nU4Zgqq2DXrsEcZPzz7dR"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:TdRMcP6nU++dT46kWgOK5kIfntc=
In-Reply-To: <v6mas4$1v1rh$2@dont-email.me>
Content-Language: en-GB
Bytes: 3241

On 10/07/2024 16:54, James Kuyper wrote:
> On 10.07.2024 16:49, bart wrote:
> ...
>> "So if arrays aren't passed by value in C, and they aren't passed by
>> reference, then how the hell ARE they passed?!"
> 
> The problem with that question is the same as the problem with the
> question "How are Justices of the US Supreme Court elected?". They
> aren't elected, so the question cannot be answered. Arrays cannot be
> passed in C, so the question of how they are passed also cannot be answered.
> 
> You can pass a pointer to the start of an array or a pointer to the
> whole array; either way,

How is that interestingly different from pass-by-reference?

Which as you know involves a pointer to the value of an object, so the 
values are not passed, only the value of the pointer.

(You may also know that every language will use pass-by-value for 
everything if you delve deeply enough.)

In C, if you have this char[4] array at this address:

   01003F8  65 66 67 00

and try to pass it to a function defined with a char[4] argument, it 
will end up passing the address 01003F8.

If I pass the same array in a similar language but using explicit 
pass-by-reference, it will also pass the address 01003F8.

So, if you were to examine the machine code of such a program which was 
generated from one of those two languages, could you tell whether it was 
from the one with true pass-by-reference, or from C which only has 
pass-by-value?