Title
May constructors of global objects call exit()?
Status
nad
Section
6.9.3.2 [basic.start.static]
Submitter
Matt Austern

Created on 2004-02-26.00:00:00 last changed 236 months ago

Messages

Date: 2004-10-15.00:00:00

Rationale (October 2004):

There is nothing in the Standard to indicate that this usage is prohibited, so it must be presumed to be permitted.

Date: 2022-11-20.07:54:16

The subject line pretty much says it all. It's a possibility that hadn't ever occurred to me. I don't see any prohibition in the standard, and I also don't think the possibility introduces any logical inconsistencies. The proper behavior, presumably, would be to go through the list of already-constructed objects (not including the current one, since its constructor wouldn't have finished executing) and destroy them in reverse order. Not fundamentally hard, and I'm sure lots of existing implementations already do that.

I'm just not sure whether the standard was intended to support this, or whether it's just that nobody else thought of it either. If the former, then a non-normative note somewhere in 6.9.3.2 [basic.start.static] might be nice.

History
Date User Action Args
2004-11-07 00:00:00adminsetmessages: + msg1102
2004-11-07 00:00:00adminsetstatus: open -> nad
2004-02-26 00:00:00admincreate