|
minimc 0.5.1
|
MiniMC primarily adheres to the Google C++ Style Guide for source code style. Cases which are not addressed in the Google C++ Style Guide are addressed individually here.
Function names should generally begin with a verb describing what it does . For instance, class methods which sample a random distribution are prefixed with Sample.
The declaration order provided in the Google C++ Style Guide is recommended. This section clarifies cases which are not explicitly mentioned therein.
Static functions (such as helper functions which do not access instance member variables) should be declared after class constants, followed by factory functions and class constructors.
friend declarations occur at the very beginning of a class declaration, before any access specifiers such as private, public, or protected.
There exist two ways to initialize variables: direct initialization and copy initialization :
Although both styles are totally valid, we prefer to use direct initialization as it avoids a potentially expensive copy operation in certain scenarios. Furthermore, we prefer to use uniform initialization's curly braces as it prevents narrowing conversions.
Of course, there will always be cases where copy initialization is simply clearer without the cost of an expensive copy (such as initializing a reference or copying an rvalue for which there is a move constructor) so the choice is ultimately up to an informed developer's discretion.
boldsymbol environment to denote vectorsbmatrix environment for displaying matrices in documentation\[ \boldsymbol{p} = \begin{bmatrix} x \\ y \\ z \end{bmatrix} \]