[latexila] Explain more code conventions
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Explain more code conventions
- Date: Fri, 29 May 2015 13:08:19 +0000 (UTC)
commit 62e4b79f20523dc55b983c68a04db11123971ee3
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri May 29 15:06:09 2015 +0200
Explain more code conventions
HACKING | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/HACKING b/HACKING
index c292539..c114287 100644
--- a/HACKING
+++ b/HACKING
@@ -44,7 +44,8 @@ For consistency, there are some conventions to follow when coding.
For Vala and C:
- no trailing spaces
- - use blank lines to space out blocks of code (only one blank line is enough)
+ - use blank lines to space out blocks of code (only one blank line is enough).
+ - space out each case in a switch, i.e. have a blank line after each 'break;'.
- as a general rule of thumb, when modifying a file use the same coding
style of that file.
@@ -53,6 +54,8 @@ For Vala:
- lines: 90 characters maximum (in some cases it can be a little more)
- /* ... */ comments for delimiting code sections
- // ... comments otherwise (e.g. for explaining just one line)
+ - curly braces are always on a separate line
+ - for one-line blocks (if, for, while, etc), no curly braces
- some spaces almost everywhere:
- function (blah); // not function(blah);
- int num = 5; // not int num=5;
@@ -60,12 +63,11 @@ For Vala:
- for (int i = 0 ; i < max ; i++) // not for(int i=0;i<max;i++)
- etc...
- do not use 'var' for declaring variables, unless the type is very long.
- The type of a variable is a form of auto-documentation.
+ The type of a variable is a form of self-documentation.
For C:
- - follow the GLib/GTK+ conventions:
- https://wiki.gnome.org/Projects/GTK%2B/BestPractices
- - indentation: GNU style
+ - follow the GNU coding style:
+ https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en
- no maximum line length (but short lines are better)
- only /* ... */ comments (for C89 compatibility)
- spacing differences with Vala:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]