Difference between revisions of "Coding Conventions"

Jump to navigation Jump to search
Mention the new STL thunks
m (→‎Endianness issues: endianess > endianness)
(Mention the new STL thunks)
 
Line 12: Line 12:
* 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.
* 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.)
 
* We implement wrappers for a subset of the Standard Template Library (STL) in common/std/, which internally use ScummVM classes. You simply need to include the appropriate file, and use Std:: rather than std:: as the namespace. Note that these should only be used when porting existing codebases already using the STL. For developing entirely new engines from scratch, you need to use the classes in /common/ directly.
Furthermore, the standard C++ library is a big no-no. Besides usually heavily relying on the above mentioned features, it also sucks up rather more resources than we would like to, so we have our own replacements for various container classes etc.


We are reviewing these decisions from time to time, but so far, in our estimation the drawbacks of using any of these outweigh the hypothetical advantages.
We are reviewing these decisions from time to time, but so far, in our estimation the drawbacks of using any of these outweigh the hypothetical advantages.
272

edits

Navigation menu