kc3-lang/angle/doc/CodingStandard.md

Branch

Download

Coding Standard for the ANGLE Project

Google Style Guide

We generally use the Google C++ Style Guide as a basis for our Coding Standard, however we will deviate from it in a few areas, as noted below.

Items marked {DEV} indicate a deviation from the Google guidelines. Items marked {DO} are reiterating points from the Google guidelines.

Before you upload code to Gerrit, use git cl format to auto-format your code. This will catch most of the trivial formatting errors and save you time.

Header Files

Scoping

Classes

Other C++ Features

Naming

File Names

Directory Names

Variable Names

Use the following guidelines, they do deviate somewhat from the Google guidelines.

Comments

//
//  Copyright $YEAR The ANGLE Project Authors. All rights reserved.
//  Use of this source code is governed by a BSD-style license that can be
//  found in the LICENSE file.
//

Formatting

Examples:

if (conditional)
{
    stuff();
}
else
{
    otherstuff()
}
switch (conditional)
{
  case foo:
    dostuff();
    break;
  case bar:
    otherstuff();
    break;
  default:
    WTFBBQ();
}
class MyClass : public Foo
{
  public:
    MyClass();
    ~MyClass() {};
  private:
    DISALLOW_COPY_AND_ASSIGN(MyClass);
};
char *c;
const string &str;

Exceptions to the Rules

Generated Source Files

Prefer storing generated sources as baked files in the repository. Avoid using GN actions to run Python scripts.

Definition:

Sometimes helper scripts can create compilable sources more easily from XML or JSON data sources than maintaining source files by hand. These scripts are often written in Python and output generated sources.

Decision

Storing generated sources in the repository makes integration easier for non-GN users. Python scripts can be expensive and slow to run at compile-time. Generated sources can be a pain point for messing up builds.

It could be possible to solve the build clobbering problem. And we could replace Python with something faster. But to allow for easier integration with our tools and customers we should bake generated files into the repository.


Source

Download