Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
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 04:28:13 -0700
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <86ed8088xe.fsf@linuxsc.com>
References: <87h6d2uox5.fsf@nosuchdomain.example.com> <20240707164747.258@kylheku.com> <877cdur1z9.fsf@bsb.me.uk> <871q42qy33.fsf@bsb.me.uk> <87ed82p28y.fsf@bsb.me.uk> <87r0c1nzjj.fsf@bsb.me.uk> <86ikxd8czu.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Thu, 11 Jul 2024 13:28:14 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="63b2cd43183ed9f1034fa7ab191192fd";
logging-data="2560763"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/nmxNgxmItfMbotaAHTtCaJePayd/WVU0="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:wjxRszBWd/u5DIrkl4v3vtGtucs=
sha1:HI9iuH8UYWdD2OBgqD7pr18OuVM=
Bytes: 2979
bart writes:
> On 10/07/2024 16:48, Tim Rentsch wrote:
>
>> bart writes:
>>
>>> 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?!"
>>
>> They aren't. C allows lots of things to be passed as an argument
>> to a function: several varieties of numeric values, structs,
>> unions, and pointers, including both pointers to object types and
>> pointers to function types. C does not have a way for a function
>> to take an argument that is either an array or a function. There
>> is a way to take pointers to those things, but not the things
>> themselves. Arrays and functions are second-class values in C.
>
> That's a good point. It's not just arrays that can't be passed by
> value (because the language says so) but also functions (because its
> not meaningful).
>
> Yet, although pointers to arrays and function can be passed (without
> even doing anything special like using &), you are not allowed to say
> that anything is passed by reference in C!
My comment is not about what people are allowed to say. It's
about what is true. The truth is, in C, all function arguments
are passed by value. That statement doesn't depend on how anyone
thinks about it or what they call it.