Sujet : Re: technology discussion → does the world need a "new" C ?
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 11. Jul 2024, 14:00:21
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6ol14$2fdrj$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Mozilla Thunderbird
On 11/07/2024 12:49, Tim Rentsch wrote:
bart <bc@freeuk.com> writes:
According to what people have said, C would STILL be a language that
passed thing by value, and never by automatic reference.
First, the scheme that you outline is either dumb or disingenuous
(or perhaps both).
Second, the argument you're making is purely ad hominem: it
isn't about what is true but about what it is people will say, or
at least what you think they would say.
Third, none of this changes the underlying reality. Whatever
people might say about your hypothetical scenario, or whatever it
is you think they would say, it doesn't alter the fact that in C
all function arguments are passed by value, and not by reference.
People don't write software based on the the precise, pedantic details of what a language reference says, which are always to use the same carefully selected set of terms.
They want to write programs that do useful tasks.
If that task calls for a function that manipulates arrays as though they were passed by reference, then, guess what, they will use a C function that the standard says always passes things by value.
For that purpose, in the mind of the user, it does the same job as 'by by reference'. That it does so by some other quirks (array decay, and the ability to index pointers as thought they were arrays), is by the by.
I understand that in this newsgroup, most posters are only interested in what the Standard says and little else, and will pounce upon any turns of phrase, any nomenclature, that deviate even slightly from what it says in that document.
I also understand that this is not comp.std.c
Meanwhile, the internet abounds with quotes like this about C:
"When we pass the address of an array while calling a function then this is called function call by reference."
"Basically, in C, function parameters that are arrays are passed by reference, by default."
Yes, I get that such lax informality would annoy the people here.