[fpc-pascal] default value of a sub range field produces No range Check error

Peter peter at pblackman.plus.com
Fri Oct 16 12:32:54 CEST 2015


On 15/10/15 16:58, Dennis wrote:
> 
> Perhaps the compiler should have a warning when defining a sub-range
> field in class, telling users that it will be default to 0.
> 

Hi,

The problem is not restricted to classes.


Type
  TSmall = 4..12;

Var B : TSmall;
...
    Writeln (B):


Shows the same issue. Takes default value of zero; no range check on the
first writeln.


Regards,
Peter



More information about the fpc-pascal mailing list