Am 17.07.2018 um 04:48 schrieb Ryan Joseph:
On Jul 16, 2018, at 7:02 AM, Sven Barth via fpc-pascal
<fpc-pascal@lists.freepascal.org> wrote:
Might come, though not in that way (take your example: what if you pass the
instance to some other code that stores it beyond the life time of the function)
That’s what you guys said about my awesome “stack alias” idea. :) Seriously
though I don’t for the life of me understand why programmers can’t be trusted
to not do this. You can pass dangling pointers since forever but no one is
asking pointers to be removed because they’re too dangerous.
Because they are programmers. They simply do it their way. And I'm
especially talking about code written by two different programmers, one
storing the instance somewhere and the other passing in an "auto"
instance without knowing that the other programmer is storing it somewhere.
Auto is a good idea. Allocating the “auto” classes the memory backend on the
stack (my “stack alias” idea) is even better because you don’t need the memory
manager too be involved.
No, it's not. And we don't *want* to change the paradigm of TObject.
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal