aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/c-style-guide.md
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-12-22 14:06:44 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-12-22 14:06:44 -0800
commitff298f68884ec48d3bb5f678278c8b21f7a1f31c (patch)
treee65fa350e7471a6d81dfd29f95d0e6810b3feaac /doc/c-style-guide.md
parentf0d916ae17832df9243cb890fe6a173de20ef891 (diff)
First round of feedback
Diffstat (limited to 'doc/c-style-guide.md')
-rw-r--r--doc/c-style-guide.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/c-style-guide.md b/doc/c-style-guide.md
index 56132931e2..87de8892dd 100644
--- a/doc/c-style-guide.md
+++ b/doc/c-style-guide.md
@@ -17,6 +17,19 @@ Header Files
------------
- Public header files (those in the include/grpc tree) should compile as pedantic C89
+- Public header files should be includable from C++ programs. That is, they should
+ include the following:
+ ```c
+ #ifdef __cplusplus
+ extern "C" {
+ # endif
+
+ /* ... body of file ... */
+
+ #ifdef __cplusplus
+ }
+ # endif
+ ```
- Header files should be self-contained and end in .h.
- All header files should have a #define guard to prevent multiple inclusion.
To guarantee uniqueness they should be based on the file's path.
@@ -31,6 +44,17 @@ C99 Features
- Variable sized arrays are not allowed
- Do not use the 'inline' keyword
+- Flexible array members are allowed (https://en.wikipedia.org/wiki/Flexible_array_member)
+
+Comments
+--------
+
+Within public header files, only `/* */` comments are allowed.
+
+Within implementation files and private headers, either single line `//`
+or multi line `/* */` comments are allowed. Only one comment style per file is
+allowed however (i.e. if single line comments are used anywhere within a file,
+ALL comments within that file must be single line comments).
Symbol Names
------------