[fpc-devel] Managed Types, Undefined Bhaviour

Michael Van Canneyt michael at freepascal.org
Fri Jun 29 12:43:48 CEST 2018



On Fri, 29 Jun 2018, Martok wrote:

>> I hope this issue gets addressed, as I deem the current behaviour completely
>> broken and also going totally against the spirit of Pascal, feeling much more
>> like some very obscure behaviour I'd expect from some C compiler.
>> Discovering the handling of this issue, however, makes me wonder
>> whether fpc aims to be a great Pascal compiler that does without bad surprises
>> and very very hard to debug "documented" behaviour or not.
> There is less undefined behaviour than in C, but the one we have will bite you
> in the most awful ways, sometimes after years of working just fine. And we don't
> even have a nice formal standards document that one could grep for "undefined".
>
> But yeah, as Jonas wrote, this _isn't_ one of these occasions. FPC uses (and
> reuses!) tempvars a lot more than Delphi, which causes all sorts of funny
> behaviours with managed types. Try returning a string or use the
> JavaScript-style "Foo().Bar().Baz()" method chaining pattern and you'll see what
> I mean.

Out of curiosity, can you give a simple example of such a funny behaviour
in such a chaining pattern ?

Michael.


More information about the fpc-devel mailing list