Google NaCL comes with at least two C++ compilers: a very old gcc version, and a very recent clang version. The gcc version does not support C++ 11, so I would rather not use it. The very new clang compiler generates intermediate code, and then either is compiled in the browser, or ones compiles it to native. I tried the first approach: having Chrome compile it in the browser. The problem: exceptions didn't work, and I need them. I checked this, but I really can't understand the fine print of this ticket. That leaves the second approach: compile the code to native before deploying... question: would I be able to use exceptions then? Or should I surrender any hope?
(... After Go and this, I'm under the impression that Google engineers really hate exceptions...)
The essence of the ticket you link to is that
you can't use C++ exceptions in PNaCl, that is, you can't use C++ exceptions if you plan to deploy as a .pexe
file (LLVM bitcode), but
you can use C++ exceptions with the Clang-based toolchain if you provide the flag --pnacl-allow-exceptions
(to both pnacl-clang and pnacl-translate) and compile and translate all the way to a set of .nexe
binaries before deployment.
In C++, as well as in pretty much any other language, exceptions should be used sparingly, and as you can see above some style guides suggest not using them at all.