Boost logo

Boost :

Subject: Re: [boost] [assert] static_assert envy
From: Holger Grund (holger.grund_at_[hidden])
Date: 2011-01-17 17:29:42

>> On Windows 7 (at least with VC++), abort() pops up one of those
>> "blah.exe has stopped working" dialog boxes. I haven't been able to
>> kill it, in spite of lots of google searches, and it drives me crazy.
Before VC++ 10 the default behavior for abort was to print a message (like
"foo.exe has requested the runtime to terminate in an usual way")for console
application or a dialog for GUI apps. The default for the app type is not
inferred from the PE image header, but rather from the type of entrypoint
used (i.e. [w]main => console app, [w]WinMain). The dialog box caption
"Visual C++" (and to a lesser extent the text) caused lots of confusion. For
that reason, I had the honor to change the default to not showing that
dialog/printing that message anymore in VC++10.

After that dialog, the CRT invokes the Windows Error Reporting (aka Watson).
Whether or not that brings up a dialog box depends on the OS version and
configuration. Typically, you would see it immediately as an administrator
user on your interactive window station. If you're not, the report would be
queued and an administrator would see it the next time logging on.

If you have a debugger installed in the AeDebug key, you could get a chance
to attach a debugger. But there have been a lot of changes again between
different OS versions (e.g. the Auto key, UAC & restricted tokens etc.)

The behavior of abort can be configured with _set_abort_behavior. WER has a
ton of registry setting and a few APIs. Win7 API also gives you a great deal
of control over error reporting.

The story is a bit different for the debug builds of the CRT. The abort
message is report via the debug interface. That's the same thing used for
the assert and _ASSERT(E) macros. Their behavior can be configured with
_CrtSetReport* functions. VC++ regressions test suites regularly install
hooks to test things that result in a debug message.

Long story short, to get rid of the "blah stopped working" you should call
_set_abort_behavior(0,_CALL_REPORTFAULT) for release builds and
_CrtSetReport* for debug builds (/MTd or /MDd)

I hope I got that right -- that's all from quickly fading memory. I have
been pretty much working on Linux only since I left Microsoft last summer.


Boost list run by bdawes at, gregod at, cpdaniel at, john at