dgbillotte / ZeroLabModules

Modules for VCV Rack
2 stars 1 forks source link

Style/Naming Conventions getting nailed down #8

Open dgbillotte opened 2 years ago

dgbillotte commented 2 years ago
class ThisClass {
private:
    int _boxLength;
    int _p1;

    int _doMath(int the_length) {
        int localVar = the_length;
    }
public:
    // For constructors use the first one if it is short and readable.
    // Use the second one for longer parameter lists or more complex ctor calls
    ThisClass(int p1, int box_length) : _boxLength(box_length), _p1(p1) {}
    ThisClass(int p1, int box_length) :
        _boxLength(box_length),
        _p1(p1)
    {}

    // single liners ok if:
    // - one, maybe two, statements
    // - must be immediately readable
    // - not crazy long, like over 80
    int boxLength() { return _boxLength; }
    void boxLength(int box_length) { _boxLength = box_length; }
}