[fpc-devel] an idea about "const param: string"
klenin at gmail.com
Sun May 29 01:16:51 CEST 2011
On Sat, May 28, 2011 at 18:17, Martin <fpc at mfriebe.de> wrote:
> On 28/05/2011 22:47, Alexander Klenin wrote:
>> Perhaps an easier thing to do is to make const string param optimization
>> controllable by compiler switch and/or directive.
>> This way, users who prefer safe behavior, can get it,
>> and those who are willing to take a risk still get a (weaker) tool to
>> detect the error --
>> by checking if the program works with the switch but crashes without it.
> The only thing that the const param (afaik) does to a string is the
> optimization to skip the ref count (and with that the implicit try finallyt
> block, that the compiler generates).
Yes, and the only thing I propose is to let the programmer turn this
> Yet, there was that link to "who to shoot yourself in the foot with
> different programming languages" => the pascal compiler does not let you
> shoot yourself in the foot.
> Well it does, it gives you "const s: string" params....
Alexander S. Klenin
More information about the fpc-devel