Open main menu

Difference between revisions of "Coding Conventions"

3 bytes removed ,  15:42, 10 August 2011
→‎Language features: Fix incorrect reason why we disable RTTI (spotted by Tron).
(→‎Language features: Fix incorrect reason why we disable RTTI (spotted by Tron).)
Line 11: Line 11:
ScummVM is written in a subset of C++. Due to limitations of the C++ run-times on various platforms, the following features cannot currently be used:
ScummVM is written in a subset of C++. Due to limitations of the C++ run-times on various platforms, the following features cannot currently be used:
* C++ exceptions (throw/catch): Not all C++ compilers support these correctly (esp. on embedded systems), and exception support incurs a noticeable overhead in binary size.
* C++ exceptions (throw/catch): Not all C++ compilers support these correctly (esp. on embedded systems), and exception support incurs a noticeable overhead in binary size.
* C++ RTTI (run-time type information, as in dynamic_cast<>): This incurs a severe overhead in binary size and memory usage, as every C++ object is enlarged by RTTI information
* C++ RTTI (run-time type information, as in dynamic_cast<>): This incurs a (to us) severe overhead in binary size, since the static tables used for objects will get bigger.
* Global C++ objects: Their constructors / destructors will not be called on certain targets, causing all kinds of bad problems and requiring ugly workarounds. (The GCC option -Wglobal-constructors helps finding code doing this.)
* Global C++ objects: Their constructors / destructors will not be called on certain targets, causing all kinds of bad problems and requiring ugly workarounds. (The GCC option -Wglobal-constructors helps finding code doing this.)


561

edits