What are the pros and cons of using Exceptions in C++ in relation to game development.
Google style guide says that they don't use Exceptions for a variety of reasons. Are the same reasons pertinent towards game development?
We do not use C++ exceptions... - google-styleguide.googlecode.com
Some issues to think about.
- How it pertains to the development of a libraries used through multiple projects.
- How does it affect unit testing, integration testing, etc?
- What does it do to using third party libraries.
Answer
There are also some nasty consequences for using exceptions in C++ if you don't know all the details of how they work. Since many games are written in C++ this may be a factor.
For example, in C++ throwing an exception in a destructor can have serious consequences. It can cause all kinds of undefined behavior and crashes, because you can get trapped in a situation where you have more than one active exception in flight. (See Item #8 of Effective C++ for more info on this.)
No comments:
Post a Comment