[fpc-devel] Redefine FillChar() to use out parameter instead

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Nov 19 09:36:46 CET 2009


Graeme Geldenhuys wrote on do, 19 nov 2009:

> Jonas Maebe wrote:
>>
>> Delphi compatibility. And Delphi does that because COM requires this
>> behaviour.
>
> Can't that behaviour be limited to Windows platform only.

It would change the behaviour of code between Windows and non-Windows  
platforms. One thing it would certainly affect is assembler code.

More importantly, another thing it would affect is that in case  
someone has written their own fillchar with an out parameter, and  
*expects* reference counted structures to be finalised at the caller  
side before they are overwritten with zeroes by their routine.  
Changing that behaviour woud
a) result in memory leaks when using such a routine
b) not be fixable without manually adding finalize calls everywhere  
this custom fillchar routine is called, since the required typeinfo is  
not available at the callee side

> Such behaviour & implementation just doesn't seem right for a project
> that prides itself by being a cross-platform compiler (project).

Cross-platform also means having the same behaviour on different platforms.


Jonas

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the fpc-devel mailing list