-
Notifications
You must be signed in to change notification settings - Fork 58
Coding Style
Johannes edited this page Dec 1, 2024
·
2 revisions
Nebula's coding style is more or less inherited from the original Nebula Device codebase, made by RadonLabs at the time.
- Indentation is Allman style with 4 whitespaces, so spaces not tabs
while (a != b)
{
foo();
}
- Functions use upper camel case, variables lower camel case
- Function bodies are prefixed with a distinct comment, even if no comment is added. First a line with just
//---and after that a/** */block
//------------------------------------------------------------------------------
/**
Sets a new string content. This will handle all special cases and try
to minimize heap allocations as much as possible.
*/
void
String::Set(const char* str, SizeT length)
{
...
}
- All access to member variables or functions is prefixed with
this->at all times
{
return this->CalculateFoo(this->barValue);
}
- No hungarian notation or any other prefixes on member variables
- Inline functions in a class are outside of the class declaration in the same header
- Headers contain a distinct copyright header and use a
.hending
#pragma once
//------------------------------------------------------------------------------
/**
@class Util::Stack
Nebula's stack class (a FILO container).
@copyright
(C) 2006 Radon Labs GmbH
(C) 2013-2020 Individual contributors, see AUTHORS file
*/
#include "core/types.h"
- Code implementation files have a shorter copyright header only containing the file name and copyright information. The
.ccfile ending is used for C++ files