580
edits
m (→Pitfalls) |
|||
Line 73: | Line 73: | ||
* When the simulation is paused, <tt>SGSubsystem::update</tt> is still called, but with <tt>dt</tt> = 0. This can easily lead to divide-by-zero errors in code; check for it explicitly if working on subsystem code that is doing time-dependency calculations. | * When the simulation is paused, <tt>SGSubsystem::update</tt> is still called, but with <tt>dt</tt> = 0. This can easily lead to divide-by-zero errors in code; check for it explicitly if working on subsystem code that is doing time-dependency calculations. | ||
* Do ''not'' catch all exceptions | * Do ''not'' catch all exceptions via <tt>catch (...)</tt> - this can mask real problems. Better granularity of exception handling does require some clean-ups to the hierarchy, so catchable / ignorable errors can be distinguished from fatal ones, but in the mean time, the safest policy is to let the main loop catch and report the exception, or to catch yourself and then re-throw. |
edits