On 11 Feb 2016 at 17:27, Emil Dotchevski wrote:
You can love it or hate it, but as a matter of fact it's not standard behavior, and I am not aware of any compiler other than MSVC that implements it. Basically, long time ago someone at Microsoft read the word "exception" and interpreted the standard incorrectly, and now they can't remove this broken behavior for legacy reasons.
Win32 structured exception handling has nothing to do with C++, it was how the NT kernel implementors decided to fix the extremely broken POSIX signals design. And it is a *superb* solution to the problem of handling unexpected failure at the system level, I really wish POSIX would mark signals entirely as deprecated and adopt pretty much exactly structured exception handling as the POSIX standard. LLVM, for the record, has implemented a very similar "universal" exception handling mechanism which allows exception throws to traverse language boundaries within LLVM, and my great hope is that once LLVM becomes universal on POSIX platforms someone will go ahead and replace signals with structured exception handling. Microsoft simply got to the same point much earlier with less practical experience and much worse tooling, and made some decision designs which with the benefit of hindsight look poor, but at the time a universal exception framework looked as valuable to Microsoft as it does today to LLVM. Microsoft's C++ implementation has a ton of warts, but you've got to remember it is the oldest C++ implementation in the world. They are *still* ABI compatible with the earliest 32 bit binaries on DOS. The fact it works as well as it does for modern C++ is an astounding engineering achievement. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/