[fpc-devel] FPC Delphi compatibility question...
Maxim Egorov
m.v.egorov at hotmail.com
Fri Jun 19 14:34:06 CEST 2009
Jonas Maebe пишет:
>
> 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?).
>
Maybe you are right. But i guess that the current FPC implementation
allows to find such errors more quickly. So maybe it would be useful to
save it for debug purposes.
More information about the fpc-devel
mailing list