Closed GoogleCodeExporter closed 9 years ago
Just to clarify: would you be OK with exceptions thrown in a .cpp file? Can you
link -fno-exceptions code with code that throws an exception? What happens when
an exception is thrown? (Presumably it crashes - and why is that better than
just enabling exceptions?)
Original comment by jbe...@gmail.com
on 7 Apr 2013 at 6:52
Yes, having exceptions in the binaries would fix my problem.
AFAIK, disabling exceptions is non-standard so the outcome is
compiler-dependent. I think it's reasonable to expect the program to crash and
probably log something to stdout. For me however it's acceptable to treat these
cases as bugs (users won't be allowed to tweak data files anyways), and as such
exceptions shouldn't occur.
Exceptions do have a overhead, and as of now I'm not using them anywhere in my
code. From my researches though, this overhead is smaller than what most people
think (see http://lazarenko.me/2011/07/22/c-exception-handling-and-performance/
and http://www.gamearchitect.net/Articles/ExceptionsAndErrorCodes.html) so I'm
thinking to get out of the 90s and start using them, but I have other
priorities for now and my current code is not always exception-safe.
Original comment by de...@gmx.it
on 8 Apr 2013 at 2:06
Exceptions are tied very closely with parsing, so I don't think I want to
remove them. Sorry :(
Original comment by jbe...@gmail.com
on 13 Apr 2013 at 6:01
Your previous question made me think about the whole exceptions matter and
after researching I've found out that propagating errors in c-style is often
slower than using exceptions, so I decided to enable them and fix my code to be
exception-safe. I'm adding this comment for other people who might be
interested.
Zero overhead exceptions only have a bad effect on the binary size. However the
extra storage is kept away from code so it doesn't affect cache. You only have
a slowdown when an exception arises, which is ideally never. Refer to my
previous links (and the links within) for more informations.
The only case where I think error codes still make sense is in embedded
software development, but then I doubt you'd be using yaml at all.
Original comment by de...@gmx.it
on 15 Apr 2013 at 8:26
Original issue reported on code.google.com by
de...@gmx.it
on 7 Apr 2013 at 5:59