This shows you the differences between two versions of the page.
— | devel:libdeng2_code_guidelines [2012-03-29 05:42] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{stub}} | ||
+ | |||
+ | This article summarizes the coding conventions and practices used in Doomsday 2.0 (libdeng2 library). | ||
+ | |||
+ | * more modular: core, legacy, data, network already present, more to come | ||
+ | * everything in " | ||
+ | * non-public headers go to the module' | ||
+ | * Qt-like convenience includes with class name, e.g. " | ||
+ | * copyright banner should be updated to match the new format in libdeng1 (with @file, @authors, < | ||
+ | * library-wide defines have a DENG2_ prefix (DENG2_USE_QT, | ||
+ | * all C APIs should go to c_wrapper.h | ||
+ | * exports are marked with DENG2_PUBLIC (no .def files on Windows) | ||
+ | * all basic number types should use the d* typedefs in libdeng2.h | ||
+ | * the data module is important to know by heart: serialization, | ||
+ | * everything goes in " | ||
+ | * error situations are handled via exceptions (see usage of DENG2_ERROR, | ||
+ | * error exceptions need to include both function name and the error description (without a period in the end) -- see the existing throws in the code | ||
+ | * beware: exceptions cannot be allowed to reach to the libdeng1 one (kills the app immediately); | ||
+ | * all non-trivial classes should use an opaque instance pointer (e.g., de:: | ||
+ | * use of libdeng2 and Qt is fully allowed on libdeng1 side in .cpp files | ||
+ | * use of Qt container classes vs. STL: both are allowed, however Qt containers usually have copy-on-write semantics so making read-only copies is O(1) | ||
+ | * all log output (previous Con_Message/ | ||
+ | * LOG_AS(" | ||