Liste des Groupes | Revenir à cl c |
BGB <cr88192@gmail.com> writes:True enough.
On 7/9/2024 12:22 PM, Ben Bacarisse wrote:I am not saying that Bart is alone in getting this wrong. Any documentbart <bc@freeuk.com> writes:>
>On 09/07/2024 16:58, Ben Bacarisse wrote:An address value is passed by value. C has only one parameter passingbart <bc@freeuk.com> writes:>
>Arrays are passed by reference:This is the sort of thing that bad tutors say to students so that they
>
void F(int a[20]) {}
>
int main(void) {
int x[20];
F(x);
}
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.
mechanism. You can spin it as much as you like, but C's parameter
passing is simple to understand, provided learner tune out voices like
yours.
Though, in ABI specs, this would usually still be termed as "pass by
reference"
that that says that C have any parameter passing mechanism other than
pass by value is wrong. But then I doubt any ABI spec says that since
an ABI is, almost by definition, not about the C language.
Les messages affichés proviennent d'usenet.