[fpc-devel] [Patch/RFC] Warnings for (in/over)complete case statements

Marco Borsari borsa77 at libero.it
Wed Jan 2 11:41:18 CET 2019

Il 01/01/2019 22:10, Martok ha scritto:

> - If a case statement on an ordinal does not contain labels for all values of
> the ordinal, and no else statement is given, raise a new warning (W6059). This
> is actually defined as an error in ISO7185 and a dynamic-violation in IEC10206.

> * in ISO mode, there are 2 solutions: in Standard Pascal, not covering the
> entire type is a compile-time error. In Extended Pascal, this is a runtime
> error. Which one is followed usually?

If we agree to check it only at runtime, then the error could be raised
everytime it is impossible to find a correspondence in the case 
statement and there is no an else clause, disregarding the completeness 
of the ordinal list and so including all types.
This way the check can be included in the $R switch.

More information about the fpc-devel mailing list