Apparently, activating -Cr is needed to enable enforcement of compile time constant range checking as well.
The ff. program:
program blah; var E: array[2..4] of Integer; begin E[10]:=15; end.
will compile albeit with a warning. Only when -Cr is enabled will the range violation become an error. Is this kind of freedom intentional and will it serve certain purposes?
For arrays of characters, the range checking is even looser. I have noticed that the ff range violation:
program blah; var D: array[2..4] of char; begin D:='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; Writeln(D); end.
is completely ignored whether -Cr is enabled or not. No error, no warning.
Question 1: Will such code result in memory corruption somewhere in both the cases where runtime range checking is enabled and the one where it is not enabled?
Question 2: Is this something that needs to be fixed or is there a philosophy/explanation behind this behaviour?
Question 3: Is this a special case for char arrays/strings only and will never happen with other types?
Note: I am using FPC 1.0.10
_______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal