[fpc-pascal]No runtime range checking?

Andy Sy andy at nospam.com
Thu Oct 2 13:14:46 CEST 2003


Andy Sy wrote:
> program blah;
> 
> type
>   stringy = array[4..10] of char;
> 
> var
>   C: stringy;
>   D: array[2..5] of char;
> 
> procedure showstring(I:Integer);
> begin
>   Write(C[I]);
> end;
> 
> begin
>   C:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
>   D:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
>   Writeln(D);
>   showstring(-5);
> end.
> 
> 
> FPC doesn't even complain about range exceeded whether
> during compilation or runtime... isn't this an egregious
> violation of Pascal's strict typing philosophy?  Does
> Turbo Pascal/Delphi behave this way as well?

Ah... turns out there's -Cr... I guess one can consider
it a debug on/off option.  Very nifty.  Just perfect.


-- 
=========================================
reply-to: a n d y @ n e t f x p h . c o m
http://www.neotitans.com
Web and Software Development






More information about the fpc-pascal mailing list