summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorc <c@chroniko.jp>2020-06-04 13:27:30 +0000
committerc <c@chroniko.jp>2020-06-04 13:28:24 +0000
commit284e9459b8840bdf9865e756a0bb0e63e56bae77 (patch)
tree3bc551dd6ed90af254d04830d0cc5bd5638e4308
parentb4ccafd175465e811d2a70627465644760cc3fa4 (diff)
downloadtor-284e9459b8840bdf9865e756a0bb0e63e56bae77.tar.gz
tor-284e9459b8840bdf9865e756a0bb0e63e56bae77.zip
doc: specify C99 coding standards
Make clear that Tor's C code targets C99 standards. This makes it more explicit what to expect for new code, because guessing from existing code is not always reliable, especially for code that predates the change in standard.
-rw-r--r--doc/HACKING/CodingStandards.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/HACKING/CodingStandards.md b/doc/HACKING/CodingStandards.md
index a181759d60..99bc3e5022 100644
--- a/doc/HACKING/CodingStandards.md
+++ b/doc/HACKING/CodingStandards.md
@@ -193,8 +193,9 @@ Why use changes files instead of entries in the ChangeLog?
## Whitespace and C conformance
-Invoke `make check-spaces` from time to time, so it can tell you about
-deviations from our C whitespace style. Generally, we use:
+Tor's C code is written in accordance with the C99 standard. Invoke `make
+check-spaces` from time to time, so it can tell you about deviations from our C
+whitespace style. Generally, we use:
- Unix-style line endings
- K&R-style indentation
@@ -213,6 +214,8 @@ deviations from our C whitespace style. Generally, we use:
- Use `void foo(void)` to declare a function with no arguments. Saying
`void foo()` is C++ syntax.
- Use `const` for new APIs.
+ - Variables should be initialized when declared, rather than declared at the
+ top of a scope.
If you use an editor that has plugins for editorconfig.org, the file
`.editorconfig` will help you to conform this coding style.