On 5-7-2011 12:34, Felipe Monteiro de Carvalho wrote:
Maybe the compiler should start issuing hints or warnings for all
places where one uses const with ansistring, so that people who don't
care about the speed advantage can start removing those const
ansistrings from their code base.
Yes, but is is no bug! It is a contract between the compiler and the
programmer in which it is expected that the string will not be modified
inside a procedure, function or method.
That is also part of the speed optimization: the compiler doesn't have
to check because of this contract. This is also the case in many other
languages.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel