Liste des Groupes | Revenir à cl c |
bart <bc@freeuk.com> writes:
Why isn't it C?The language could have helped a little by making this invalid:But it doesn't. Why should we waste time in comp.lang.c explaining how
>
int A[20];
>
void F(int B[20]) {}
>
The type of B looks just like that of A, but it isn't; the T[N] type
is silently changed to T*. The language could insist that you write:
>
void F(int* B) {}
C *could* have been defined? It's hard enough to explain how it
actually is defined, especially with your contributions.
This way, it is far clearer that a pointer is being passed, and 'passBut that's not C.
by value' now makes more sense. The way B will be used is now
consistent with the same declaration anywhere else.
Les messages affichés proviennent d'usenet.