-
Notifications
You must be signed in to change notification settings - Fork 30
Coding Guidelines
Eduardo Pinho edited this page Aug 25, 2017
·
3 revisions
Although we are dealing with old code, it doesn't mean we should aimlessly work our way into it. A few tips on programming for the OpenNotrium project are shown below.
Modern C++ development can make coding more efficient, simple and less dependent on third-party libraries. On the other hand, a few compilers are some steps behind on implementing the full specifications. Therefore, it is proposed that we only use the features of C++11 that are available on both GCC 4.8 and Visual Studio 2013. Here's a part of what we can use in OpenNotrium:
- The auto keyword for variable type inference;
- nullptr;
- static_assert;
- Initializer lists;
- long long type (at least 64-bits in size);
- Rvalue references (
&&, used for holding expiring objects); - Scoped enums (
enum class); - Lambdas;
- Variadic templates;
- Alias templates (with the
usingkeyword to create template-compatible aliases); - Defaulted, deleted and delegated functions (constructors and destructors).
When possible, refer to the official C++ Core Guidelines for additional guidance in new or refactored code.