Sujet : Re: technology discussion → does the world need a "new" C ?
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 12. Jul 2024, 14:59:01
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6rcr5$320pj$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 23 24
User-Agent : Mozilla Thunderbird
On 12/07/2024 12:44, Janis Papanagnou wrote:
On 11.07.2024 22:37, bart wrote:
On 11/07/2024 21:29, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
>
This my first comment on the subject:
>
"Arrays are passed by reference:
...
Although ..."
>
And that statement was incorrect, even with the "Although".
>
So arrays are passed by value? Gotcha.
Neither is true. - Tertium datur!
"Array passing" is in "C" realized using a pointer passing
mechanism where the pointer is passed "by value".
Neither an array is passed [by value] nor there's a "call
by reference" mechanism in "C".
So how are the elements of the caller's array accessed?
No copies have been supplied to the caller. So access is by ... ?
Look, there are only two choices: 'pointer' and 'reference', which in C are more or less the same thing:
"6.2.5p20 ... A pointer type describes an object whose value provides a reference to an entity of the referenced type."
So I said 'arrays are passed by reference'; maybe I should have said 'array elements are passed by reference' (which suggests that each has its own reference), so shoot me.
But everyone was so keen to prove me wrong and incapable of understanding.
This has been explained (also with references to original
sources) to you many times.
Could you be a bit more patronising, please?