This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:dg_code_style_guide [2017/09/13 09:04] – [DrumGizmo Code Styleguide] deva | dev:dg_code_style_guide [2024/07/26 10:46] (current) – [Classes] deva | ||
---|---|---|---|
Line 122: | Line 122: | ||
}; | }; | ||
</ | </ | ||
+ | |||
+ | Member variables should always be initialized in the header file, and should use the curly-brace notation: | ||
+ | <code c++> | ||
+ | class MyClass | ||
+ | { | ||
+ | private: | ||
+ | int some_member_variable{}; | ||
+ | int start_position{42}; | ||
+ | static constexpr int step_size{2}; | ||
+ | std:: | ||
+ | }; | ||
+ | </ | ||
+ | |||
=====Pointers and References===== | =====Pointers and References===== | ||
Pointer stars and reference ampersands must be placed to the left without space after the type: | Pointer stars and reference ampersands must be placed to the left without space after the type: |