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
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to