Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2019-01

Re: [Patch/RFC] Warnings for (in/over)complete case statements

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marco Borsari

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

Show quoted text 7 lines
- 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. Marco

Reply by email