Jump to content
Fraser

exceptions and static storage duration objects

Recommended Posts

If I have an object with static storage duration that throws an exception while constructing it is not caught by the expected catch statement.  Instead there is an external exception EEFACE and 'Abnormal program termination' is reported.  This only happens with a VCL application.  The code would work otherwise.  I have to have my object declared static in a function that returns it by reference in order that its construction will be delayed until after something clearly VCL related.  This must be something that is known about.  I am not providing example code because the requirements for this are described adequately.  BTW this is not the undeterminable order of construction of objects of static storage duration problem.

Share this post


Link to post

An object is declared in a cpp file at namespace scope.

Share this post


Link to post
15 minutes ago, Fraser said:

An object is declared in a cpp file at namespace scope.

That is not what you described originally:

Quote

I have to have my object declared static in a function

Two different things.  So, which one are you actually working with? Can you provide a code example that is crashing for you?

Share this post


Link to post

What appears to be required is a VCL project with an object declared at global scope that throws during construction and an appropriate catch statement in the constructor that will not catch the exception.

Share this post


Link to post

I've tried that and the bug has not materialised.  Probably it requires a large project to appear.

Share this post


Link to post
44 minutes ago, Fraser said:

What appears to be required is a VCL project with an object declared at global scope that throws during construction and an appropriate catch statement in the constructor that will not catch the exception.

Without an example showing the error in action, it is hard to diagnose this.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×