[fpc-devel] "Blank slate" next version of FPC

Martin Frb lazarus at mfriebe.de
Sun Feb 24 17:07:49 CET 2019

On 24/02/2019 16:48, Jonas Maebe wrote:
> You can disable these exception frames with {$implicitexceptions off}. 
> If you want to disable it for TObject, you have to recompile the 
> system unit with that switch, since the code for TObject's constructor 
> is inside that unit.
> ld never do this.

Actually use {$implicitexceptions off} on your inherited constructor, 
and do omit the call to "inherited Create" where it would call 
That assumes, that TObject is the only parent in the RTL (or fpc packages)

But it seems that the current way of protecting the constructor is more 
costly than needed.
Each constructor (and each parent constructor) has/have a try/except.

The parent constructor should only need this, if they are called 
directly, but not if they are called via inherited (equals called on the 

In fact if I do "ObjIntstance.Create()" an implicit try/except is created.
In the except handler is a test, that will skip calling the destructor 
in this case, meaning there will be no action in the except handler.

The constructor code already tests if it is called on an instance or 
not, to decide if it needs to call NewInstance.
It could do the same (actually use the very same conditional block) to 
decide on creating the try/except.

This would reduce the amount of times, that an implicit handler is 
actually created.

More information about the fpc-devel mailing list