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 <20240709152805.587@kylheku.com>
Deutsch   English   Français   Italiano  
<20240709152805.587@kylheku.com>

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: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: technology discussion =?UTF-8?Q?=E2=86=92?= does the world need
 a "new" C ?
Date: Tue, 9 Jul 2024 22:32:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <20240709152805.587@kylheku.com>
References: <v66eci$2qeee$1@dont-email.me> <v67gt1$2vq6a$2@dont-email.me>
 <v687h2$36i6p$1@dont-email.me> <871q48w98e.fsf@nosuchdomain.example.com>
 <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>
Injection-Date: Wed, 10 Jul 2024 00:32:45 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7b522d35a8b6a4705d66078d67bdff1e";
	logging-data="1644188"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19QYpWcI6FHrnNC5s8gLR6BwvGkdWcvRbE="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:kgybxKsQCwdqnugdfr7xwzUhSpo=
Bytes: 3026

On 2024-07-09, bart <bc@freeuk.com> wrote:
> 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.

In C, arrays are not passed to functions, period.

Therefore ABIs do not say anything about array parameters,
(or if they do, it's not in relation to C).

An array can be wrapped in a struct: struct a { int a[42] }.
/That/ can be passed to a function, in the only way that C supports,
which is by value.

At the ABI level, passing of structs may be by address or copy,
and it may be dependent on the size. A small structure an be passed
as a parameter, or couple of parameters, which may be registers.
That's an implementation detail, all corresponding to "pass by value".

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca