Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As a person working in a large exception-free C++ environment, I'm all ears.


I assume you're making use of no-throw placement new and not touching any standard library type, whose error conditions as available only via exceptions as per ISO C++.

Otherwise good luck porting that exception free code across multiple OSes and C++ compilers, not only the big three.


What standard library? ;)

There is a "turn code into object file using compiler" C++, that is much different from "committee vision" C++, and until recently (probably until initializer lists), -fno-exceptions -fno-rtti -ffreestanding did not emmit standard library symbols, except maybe static initialization.

Current C++ is being glued to library like crazy, look at continuations...


The one defined by ISO/IEC 14882 in a vault in Geneva.


Presumably they just use -fno-exceptions, and not everyone has to have portable code. I appreciate the concept but pragmatically there are plenty of C++ server side projects that only use Clang and GCC


“-fno-exceptions“

Here-in lies the problem. This only says “no std::exception” “no throw” but nothing is stopping you from writing your own template for error handling. An exception is by definition a “unexpected condition” and we all have to handle exceptions in some form or fashion. Whether that’s with error codes, macro checks, or the like. That’s my point. Exception free code doesn’t exist. Safety guarantees are compile time at best. If this weren’t true, things like memory manipulation wouldn’t be possible. But it is. CheatEngine exists. Funnest thing is to read a var, set a var, and then check if the set var equals the set value or if it equals the old value. You just detected a memory pin cheat.


I think you're terribly misguided here; when people discuss "no exceptions" here, they do not mean "any error handling that is not the typical/expected flow", they mean "getting rid of built-in exception system that comes with the heavy price of stack unwinding and the related mechanisms", not that they do not want to handle errors.


Yeah, and then come into twitter complaining when the code fails spectacularly after a compiler upgrade.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: