Compiler exception switches

At this point, it is worth explaining why you have compiled your code with the /EHsc switch. The simple answer is, if you do not use this switch the compiler will issue a warning from the Standard Library code, and as the Standard Library uses exceptions you must use the /EHsc switch. The warning tells you to do this, so that is what you do.

The long answer is that the /EH switch has three arguments that you can use to influence how exceptions are handled. Using the s argument tells the compiler to provide the infrastructure for synchronous exceptions, that is, C++ exceptions that may be thrown in a try block and handled in a catch block, and that have stack unwinding that calls the destructors of automatic C++ ...

Get Beginning C++ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.