[fpc-pascal] Error? No range checks in mode delphi?

Marcos Douglas B. Santos md at delfire.net
Mon Jun 3 21:48:49 CEST 2019


On Mon, Jun 3, 2019 at 4:46 PM Anthony Walter <sysrpl at gmail.com> wrote:
>
> Is the following a bug in the compiler or a feature? Is would seem using {$mode delphi} allows code which clearly violates range bound to compile without error.
>
> program Project1;
>
> {$mode delphi}
>
> type
>   TSuit = (suHeart, suDiamond, suClub, suSpade);
>   TRedSuit = suHeart..suDiamond;
>
> var
>   Suit: TRedSuit;
> begin
>   // This should generate an error, but {$mode delphi} allows it
>   Suit := suClub;
> end.

Debugging option -> check Range (-Cr)

regards,
Marcos Douglas



More information about the fpc-pascal mailing list