Are there any real-world cases for C++ without exceptions?

Posted by Martin on Programmers See other posts from Programmers or by Martin
Published on 2011-10-10T15:37:09Z Indexed on 2012/04/06 5:40 UTC
Read the original article Hit count: 276

Filed under:
|

In When to use C over C++, and C++ over C? there is a statement wrt. to code size / C++ exceptions:

Jerry answers (among other points):

(...) it tends to be more difficult to produce truly tiny executables with C++. For really small systems, you're rarely writing a lot of code anyway, and the extra (...)

to which I asked why that would be, to which Jerry responded:

the main thing is that C++ includes exception handling, which (at least usually) adds some minimum to the executable size. Most compilers will let you disable exception handling, but when you do the result isn't quite C++ anymore. (...)

which I do not really doubt on a technical real world level.


Therefore I'm interested (purely out of curiosity) to hear from real world examples where a project chose C++ as a language and then chose to disable exceptions. (Not just merely "not use" exceptions in user code, but disable them in the compiler, so that you can't throw or catch exceptions.) Why does a project chose to do so (still using C++ and not C, but no exceptions) - what are/were the (technical) reasons?


Addendum: For those wishing to elaborate on their answers, it would be nice to detail how the implications of no-exceptions are handled:

  • STL collections (vector, ...) do not work properly (allocation failure cannot be reported)
  • new can't throw
  • Constructors cannot fail

© Programmers or respective owner

Related posts about c++

Related posts about exceptions