[fpc-devel] FPC Delphi compatibility question...
Jonas Maebe
jonas.maebe at elis.ugent.be
Fri Jun 19 13:44:24 CEST 2009
On 19 Jun 2009, at 13:21, Florian Klaempfl wrote:
> Jonas Maebe schrieb:
>>
>> On 19 Jun 2009, at 12:01, Maxim Egorov wrote:
>>
>>> It's not true in the case of functions that return dynamic arrays,
>>> strings or interfaces. Because of these types require special
>>> finalization and they must be initialized to nil by default.
>>
>> That is an implementation detail, and not something you can rely on
>> as
>> far as semantics are concerned.
>
> Variables of those types are initialized to nil at scope entry. I'd
> consider result as variable.
Yes, but as far as I am concerned that is an implementation detail
(it's done because otherwise you get crashes when assigning something
to such variables due to the way the garbage collection is
implemented). This means that if you have an undefined value, the
compiler should be free to replace this undefined value with whatever
it wants (since the result is semantically undefined anyway, why not
make it as efficient as possible?).
Jonas
More information about the fpc-devel
mailing list