BSD 3-Clause License
Copyright (c) 2020-2021, Dror Smolarsky All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Follow the Bazel BUILD coding style
Unless noted otherwise below, follow the C++ core guidelines
Unless noted otherwise below, follow the Google C/C++ coding style
In cases where the Google code style contradicts the C++ core guidelines prefer the guideline from the C++ core guideline.
All C++20 features are allowed.
Prefer using the #pragma once pre processor directive to header guards.
Rational:
The #pragma once directive is safer and easier to use. It is supported on most modern compilers that support C++20.
Use Doxygen style comments to document classes, enums, functions and fields. Rational:
- Being able to generate documentation in various formats may prove useful in the future
- Doxygen style comments provide a consistent easy to read documentation style
Doxygen style:
- Use /// as a doxygen comment line prefix
- Prefer to use ///< to document arguments, enum values and fields
Use exceptions derived from std::exception to indicate an error. Prefer using standard C++ exceptions from stdexcept.
Mark all functions that do not throw with noexcept modifier.
The noexcept modifier will let the caller know how errors are handled.
Rational:
Google code style forbids throwing exceptions. However the C++ core guidelines recommend using them. In addition in the future the new C++ determinstic error specification may become part of the standard. If/when this happens, exception runtime and memory usage may become deterministic.
Pointer (*) and reference (&) expressions must be aligned left. Rational:
- This makes it easier to see the variable type for pointers and references
Follow the Google Java coding style.
Follow the Kotlin Style Guide
Follow the Apple Coding Guidelines for Cocoa
Follow the Python Style Guide
Use YAPF to format Python code.
Follow the Google Shell Style Guide
Fololow the Google Swift Style Guide