mgerhold / silly-sprites

MIT License
4 stars 0 forks source link

add section about the order of members to the styleguide #53

Closed mgerhold closed 1 year ago

mgerhold commented 1 year ago

Discussed in https://github.com/mgerhold/silly-sprites/discussions/43

Originally posted by **mgerhold** August 1, 2023 While @PurpurTentakel97 was reviewing [this code](https://github.com/mgerhold/silly-sprites/blob/d83f6d24fb68e2eca633052f3a2b3ad8e9b3d153/src/silly_sprites/entity.hpp#L9-L46), the question occurred whether we should add a section to the styleguide that defines the preferred ordering of class members and also whether they should be split between data members and member functions. Let's use this thread to discuss the topic. My personal suggestion: * data members at the top (first public, then private) * member functions below (first public, then private) * the language forces us to put type aliases before we use them (order matters for those), so I'd suggest: * public type aliases before anything else * private type aliases wherever you want (but preferably at the top of the private section that needs them) What are your opinions? :)