[fpc-devel] Const optimization is a serious bug
michael.vancanneyt at wisa.be
michael.vancanneyt at wisa.be
Thu Jul 7 09:21:00 CEST 2011
On Thu, 7 Jul 2011, Chad Berchek wrote:
>
> Michael wrote:
>> You can always fool the compiler. The compiler trusts you and assumes
>> that what you tell her is true...
>
> Yes, of course you can always fool the compiler, it just shouldn't be
> the other way around. The example you gave is very different for one
> very important reason: you show using explicit allocating and freeing of
> an object. With strings, the programmer does not, and cannot, explicitly
> allocate or deallocate the resources, and the problem lies in the
> behavior of the automatic allocation and deallocation. Thus there is
> nothing in common between this example and the problem at hand.
Nonsense.
The example is reproducible just as well with shortstrings or plain records,
where there is no 'allocation' or 'Deallocation'. Such examples can wreak
havoc just as much. With the example I showed, it's just much more clear.
(i.e. a straight crash)
Michael.
More information about the fpc-devel
mailing list