[fpc-devel] Minor debate with ISO standard on case blocks
thaddy
thaddy at localhost
Tue Jul 30 13:27:34 CEST 2019
Scott Franco a.k.a. Moore says this, what makes sense, in his manual
"Rules of ISO 7185":
==========================
Case statement
The case statement defines an action to be executed on each of the
values of an ordinal:
case x of
c1: statement;
c2: statement;
...
end;
The "selector" is an expression that must result in an ordinal type.
Each of the "case labels" must be type compatible with the selector. The
case statement will execute one, and only one, statement that matches
the current selector value. If the selector matches none of the cases,
then an error results. It is NOT possible to assume that execution
simply continues if none of the cases are matched. A case label MUST
match the value of the selector.
==========================
So the core is that his interpretation is: selector - on use - *must*
match an existing label. Ergo not the ordinal type but its value
determines if it is an error or not.
FPC currently has it the other way around: if the case has insufficient
processing for ALL possible values for the selector it already throws a
compile-time error.
That's in my opinion the wrong interpretation.
More information about the fpc-devel
mailing list