Sujet : Re: Loops (was Re: do { quit; } else { })
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.cDate : 13. May 2025, 07:03:59
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <86v7q5vygg.fsf@linuxsc.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.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
James Kuyper <
jameskuyper@alumni.caltech.edu> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
>
It isn't just that checking the condition cannot be done in general.
To be reliable the parameter length information would need to be
part of the function's type.
>
The problem is much deeper than that. The same pointer can point
to different arrays, or different positions in the same array,
during different passes through the same line of code. Some of
those would violate this rule, others would not. I don't see how
violating such a rule could ever be made a constraint violation.
[...]
An implementation could issue a diagnostic whenever it could
determine that the requirement had been violated, and also
whenever it could not establish that the requirement was
satisfied. A message like
"this call to function foo() might not supply a large enough
array to satisfy an array static length requirement".
would, I think, satisfy the letter of the rule that any constraint
violation must result in at least one diagnostic being produced.
Granted, I think most people would find such behavior more
annoying than useful, but it does seem to be a way to meet the
stipulations for constraint violations, in letter even if not in
spirit.