[fpc-devel] Data flow analysis (dfa) and "case ... of"

Juha Manninen juha.manninen62 at gmail.com
Mon Jun 5 19:07:09 CEST 2017

For some reason my reply went only to Denis first. Another try here...

On Mon, Jun 5, 2017 at 7:46 PM, Denis Kozlov <dezlov at gmail.com> wrote:
> Result is undefined if caller passes an out of range value.
> An example: TControlBorderSpacing.GetSpace(TAnchorKind(-1));
> Result is indeed not initialized, so silencing this message may be harmful.

Yes but that is an illegal situation. It is already trapped by range check -Cr.
The compiler can safely assume that such situation does not happen.
Actually the compiler already assumes that in other situations. I
remember a bug years ago in Lazarus, caused by an out of range enum
value. FPC had changed its behavior and the bug got triggered.


More information about the fpc-devel mailing list