Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add Comment Style Guide #4573

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ XX is a number between 02-99. Currently, 00_revision_history.md
contains the documentation revision history, and 01_overview.md is the
overview of the compiler goals and architecture.

## Documentation Comments Style Guide
- Use triple slashes `///` for documenting functions and classes in files.
- Double slashes `//` should be used for "internal" comments within functions.
- For rare occasions such as adding comments to multi-line macros, you may use `/* ... */` style comments.

Happy writing! Should you have any questions, please don't hesitate to ask.

## Git usage
Expand Down Expand Up @@ -248,6 +253,8 @@ To add a new input test with a sample P4 code file (under `testdata/p4_16_sample

* We generally follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). This is partially enforced by `cpplint` and `clang-format` and their respective configuration files. We have customized Google's `cpplint.py` tool for our purposes. The tool can be invoked with `make cpplint`. To be able to run `clang-format` on Ubuntu 20.04, install it with `pip3 install --user clang-format`. Do not use the Debian package. Both tools run in a git hook and as part of CI.

* Commenting Style is guided by the [following rules](#documentation-comments-style-guide).

* Watch out for `const`; it is very important.

* Use `override` whenever possible (new gcc versions enforce this).
Expand Down
Loading