[fpc-devel] Dangerous optimization in CASE..OF
Mattias Gaertner
nc-gaertnma at netcologne.de
Sun Jul 16 20:58:15 CEST 2017
On Sun, 16 Jul 2017 10:34:18 -0400
DaWorm <daworm at gmail.com> wrote:
> If the programmer builds a case statement on an enum, that includes all of
> the possible enum values, and also includes an else clause, to me it seems
> the programmer is implicitly telling the compiler that there is the
> possibility of illegal values stored in the enum.
IMO the word "illegal" is wrong here.
Usually this is used for future extensions. For example when eventually
the enumtype is extended by a new value. The 'else' part can for
example raise an exception. So the 'else' part is not for handling
"illegal", but not-yet-known values.
Mattias
More information about the fpc-devel
mailing list