[fpc-pascal]range-checking observations and questions

Peter Vreman peter at freepascal.org
Fri Oct 3 09:50:08 CEST 2003

> 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?

No memory corruption. The length of the array is passed to the helper routine

> Question 2:
> Is this something that needs to be fixed or is there a
> philosophy/explanation behind this behaviour?

A compile time warning can be added for the string to array assignment

> Question 3:
> Is this a special case for char arrays/strings only and will
> never happen with other types?

char arrays are special, they are zero terminated strings and therefor
allow assignment of constant string values. An array of byte can't be
filled with a string.

More information about the fpc-pascal mailing list