Skip to content

Latest commit

 

History

History
103 lines (78 loc) · 1.12 KB

CONTRIBUTING.md

File metadata and controls

103 lines (78 loc) · 1.12 KB

Contribution Guide

Formatting

Slightly modified "Chromium" clang-tidy configuration.

Style

See https://google.github.io/styleguide/cppguide.html.

Quick start:

Class member variables

class Thing {
    std::string foo_;
    std::string bar_baz_;
};

Struct member variables

struct Thing {
    std::string foo;
    std::string bar_baz;
};

Class names

class Foo;
class BarBaz;

Functions

DoTheFoo();
Bar();

Methods

struct Thing {
    uint64_t Size(); // Getter
    void DoTheFoo();
};

Constants

const int kFooBarBaz = 1;

Enums

enum class Foo {
    kUnknown = 0,
    kBar,
};

Divergence: file names

In C:

file_name.c
file_name.h

In C++:

file_name.cpp
file_name.hpp

Divergence: getters

struct Thing {
    // Good
    uint64_t Size();

    //Bad
    uint64_t size();
};

C++ Standard

C++17.

C Standard

C99.

Testing

Use googletest.

Exporting

Symbols should be hidden by default. Only export what is part of the public API.

Include Guards

Use #pragma once.