forked from rose-compiler/rose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RoseStyleGuide.txt
34 lines (27 loc) · 1.62 KB
/
RoseStyleGuide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Hi,
I will be happy to discuss this with anyone who cares, and I wish to make
the GREATEST attempt to not come off like a code Nazi, but it would be help
to me if we have a few guidelines about the style of code produced in ROSE.
I will be happy to discuss what should and should not be included within
these guidelines at any time.
This is an attempt to start some rough coding standards for code that is
intended to be contributed to the ROSE project. Please try to consider
that people left on the ROSE project after you leave have to be able to
maintain and build on your work (this means understanding it trivially).
1) Formatting of source code
a) Please no tabs in source code.
b) Just about any formatting will work except one that does not
include comments. My attempt is to give everyone some room
for their own style (to a point at least).
c) Please indent your source code clearly (each block) 3-5 spaces
(I use 5, but I am perhaps a bit obsessed with the issue).
2) Use of language constructs
a) Check all calls to operator "new" with "assert(pointer != NULL);"
b) Use assertions liberally elsewhere.
3) Update doxygen documentation
4) Establish policy about handling of code that is commented out
Quinlan is the world's biggest offender here, but he WILL clean it up (later)!
5) Please have only one exit from a function (no multiple returns)
The reasoning here is that it makes if difficult to add testing
code later, since each return must be rewritten (and at a time
when rewriting the function is not convenient).