Sujet : Re: technology discussion → does the world need a "new" C ?
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 11. Jul 2024, 19:53:40
Autres entêtes
Organisation : None to speak of
Message-ID : <87msmnu5e3.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13)
bart <
bc@freeuk.com> writes:
[...]
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.
[...]
Those "quirks" are a rich source of confusion and bugs for anyone who
doesn't understand how this stuff is actually defined. (Yes, I'm
acknowledging, yet again, that the way C specifies its treatment of
arrays is confusing.)
A user who thinks that arrays are simply "passed by reference" is likely
to try to apply sizeof to an array parameter (and might or might not get
a diagnostic from the compiler). A slightly more sophisticated user is
still likely to be unsure of just where the "quirks" are.
What have you ever done to help make that kind of error less likely?
What is your goal?
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */