This is an automated email from the ASF dual-hosted git repository.
dehowef pushed a commit to branch new-web
in repository https://gitbox.apache.org/repos/asf/age-website.git
The following commit(s) were added to refs/heads/new-web by this push:
new a011896e Updated the coding style (#198)
a011896e is described below
commit a011896ee6a3634649206c5ced8ab5fc42fb170d
Author: Matheus Farias de Oliveira Matsumoto
<[email protected]>
AuthorDate: Tue Sep 26 11:41:18 2023 -0300
Updated the coding style (#198)
---
src/pages/contribution/guide.md | 46 ++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/pages/contribution/guide.md b/src/pages/contribution/guide.md
index 345f26f1..ce4b3ab3 100644
--- a/src/pages/contribution/guide.md
+++ b/src/pages/contribution/guide.md
@@ -180,27 +180,27 @@ else
}
```
-If all the bodies of if/else statement contain a single line, omit braces. See
below.
+Braces should be used consistenly for if/else statements, regardless of the
number of lines in their bodies. See below.
```
if (x is true)
- we do a
-
-if (y is true)
- we do b
-else
- we do c
-
-```
-
-One exception is do statement. See the following example.
-
-```
-do
{
- body of do-loop
-} while (condition);
+ we do a
+ if (y is true)
+ {
+ we do b
+ }
+ else
+ {
+ we do c
+ }
+ /* Here's an example using do-while */
+ do
+ {
+ body of do-loop
+ } while (condition);
+}
```
### Naming
@@ -213,8 +213,7 @@ Use typedef only for struct and enum. It must not be used
for pointer types.
### Commenting
-For multi-line comments, use C style multi-line comments.
-For single-line comments, use C++ style single-line comments.
+For multi and single-line comments, both `//` and `/**/` can be used.
See below.
```
@@ -226,13 +225,14 @@ void f(void)
{
// This is to check...
if (y is true)
+ {
we do b
-
- /*
- * We need to do this here
- * because of ...
- */
+ }
+ /* We need to do this here because of ... */
for (;;)
+ {
+ /* More code here... */
+ }
}
```