- Timestamp:
- Jul 9, 2009 1:42:43 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 49841
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/VBox-CodingGuidelines.cpp
r19010 r21440 197 197 * @endcode 198 198 * 199 * 200 * 201 * @subsection sec_vbox_guideline_compulsory_cppmain C++ guidelines for Main 202 * 203 * Main is currently (2009) full of hard-to-maintain code that uses complicated 204 * templates. The new mid-term goal for Main is to have less custom templates 205 * instead of more for the following reasons: 206 * 207 * - Template code is harder to read and understand. Custom templates create 208 * territories which only the code writer understands. 209 * 210 * - Errors in using templates create terrible C++ compiler messages. 211 * 212 * - Template code is really hard to look at in a debugger. 213 * 214 * - Templates slow down the compiler a lot. 215 * 216 * In particular, the following bits should be considered deprecated and should 217 * NOT be used in new code: 218 * 219 * - everything in include/iprt/cpputils.h (auto_ref_ptr, exception_trap_base, 220 * char_auto_ptr and friends) 221 * 222 * Generally, in many cases, a simple class with a proper destructor can achieve 223 * the same effect as a 1,000-line template include file, and the code is 224 * much more accessible that way. 225 * 226 * Using standard STL templates like std::list, std::vector and std::map is OK. 227 * Exceptions are: 228 * 229 * - Guest Additions because we don't want to link against libstdc++ there. 230 * 231 * - std::string should not be used because we have iprt::MiniString and 232 * com::Utf8Str which can convert efficiently with COM's UTF-16 strings. 233 * 234 * - std::auto_ptr<> in general; that part of the C++ standard is just broken. 235 * Write a destructor that calls delete. 199 236 * 200 237 *
Note:
See TracChangeset
for help on using the changeset viewer.