[fpc-devel] Const optimization is a serious bug

Daniël Mantione daniel.mantione at freepascal.org
Mon Jul 11 00:03:05 CEST 2011



Op Sun, 10 Jul 2011, schreef Jonas Maebe:

>
> On 10 Jul 2011, at 21:40, Daniël Mantione wrote:
>
>> Op Sun, 10 Jul 2011, schreef Chad Berchek:
>>
>>> I think we really cannot assume anything about what exactly will happen with regard to the calling convention, which is what I was worried about earlier.
>>
>> Within a certain calling convention, the behaviour of const is defined and will not change.
>
> Actually, even that is not true: http://wiki.freepascal.org/User_Changes_Trunk#Const_parameter_passing_on_non-Win64_platforms
>
> const parameters are indeed not suited to assembler routines for that reason.

Calling conventions should in principle be eternally frozen. This includes 
const, because for exampe a DLL compiled in version x can be imported by a 
program compiled by version y. The fact that it has happened (for whatever 
reason) does not mean it is good practise.

Daniël


More information about the fpc-devel mailing list