update
This commit is contained in:
parent
6f48cba5e8
commit
6483c9584b
30
HACKING
30
HACKING
|
@ -8,13 +8,13 @@ Coding Style
|
|||
|
||||
Examples:
|
||||
BAD:
|
||||
``if(a)``
|
||||
``if (a)``
|
||||
BAD:
|
||||
``if(a!=NULL)``
|
||||
``if (a!=NULL)``
|
||||
GOOD:
|
||||
``if(a != NULL)``
|
||||
``if (a != NULL)``
|
||||
GOOD:
|
||||
``if(a != 0)``
|
||||
``if (a != 0)``
|
||||
|
||||
- Put figure brackets ``{}`` even if you have only one operator
|
||||
in ``if``, ``for``, etc. This also makes code easier to read and
|
||||
|
@ -24,12 +24,29 @@ Coding Style
|
|||
BAD:
|
||||
.. line-block::
|
||||
|
||||
if(a != NULL)
|
||||
if (a != NULL)
|
||||
message(G_LOG_LEVEL_MESSAGE, "Ko");
|
||||
GOOD:
|
||||
.. line-block::
|
||||
|
||||
if(a != NULL) {
|
||||
if (a != NULL) {
|
||||
message(G_LOG_LEVEL_MESSAGE, "Ok");
|
||||
}
|
||||
|
||||
- Put SPACES before the opening round bracket and after the closing round
|
||||
bracket. One more time, it improves the readability of the code.
|
||||
|
||||
Examples:
|
||||
BAD:
|
||||
.. line-block::
|
||||
|
||||
if(a != NULL){
|
||||
message(G_LOG_LEVEL_MESSAGE, "Ko");
|
||||
}
|
||||
GOOD:
|
||||
.. line-block::
|
||||
|
||||
if (a != NULL) {
|
||||
message(G_LOG_LEVEL_MESSAGE, "Ok");
|
||||
}
|
||||
|
||||
|
@ -42,4 +59,3 @@ Coding Style
|
|||
``return(0);``
|
||||
|
||||
- Check for memory leaks.
|
||||
|
||||
|
|
Loading…
Reference in New Issue