Liste des Groupes | Revenir à cl c |
On 19/08/2024 01:01, Ben Bacarisse wrote:Bart <bc@freeuk.com> writes:>
>You or he would have to go into more detail, such as an actual example, toNo one has said any such thing, so I can't see how any more detail could
demonstrate whatever it is that you think is wrong about passing a pointer
argument by-reference.
help. I suspect you've lost track of the point being made.
Probably, and perhaps not just me! But I'd still quite like to know exactly
what it is that is marked as 'disallowed'.
>I can't see what is confusing you about this. I agree with the aboveI can't unravel this. Take, as a concrete example, C++. You can't pass>
a pointer to function that takes an array passed by reference. You can,
of course, pass a pointer by reference, but that is neither here nor
there.
OK. So why do you agree with this:
>>C call-by-value call-by-reference
=============== =================
(pointer argument) F(p) (disallowed)
What is 'pointer argument' here?
for exactly the reasons I wrote.
Do you mean: 'You can't pass a pointer to a function that takes an array
passed by reference'?
It would be wrong (and is wrong in>
C++) to pass a pointer where an array reference is expected.
Well, putting aside pass-by-reference, that would be wrong in C too, if you
interpret 'array reference' to be a type like T(*)[], and a 'pointer' a
type like T*.
With pass-by-reference added to C, there would be stronger type checking,
so if something is disallowed, it would be for a good reason, not just
because Tim said so.
Les messages affichés proviennent d'usenet.