Skip to content

Commit 4bb5660

Browse files
updated coding rules (by tritikm)
1 parent afb9f77 commit 4bb5660

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

CODING_STANDARD

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
11
Here a few minimalistic coding rules for the cprover source tree:
22

3-
a) 2 spaces indent, no tabs
4-
b) no "using namespace std;"
5-
c) Avoid new/delete, use containers instead.
6-
d) Avoid unnecessary #includes, especially in header files
7-
e) No lines wider than 80 chars
8-
f) Put matching { } into the same column
9-
g) If a method is bigger than a page, break it into parts
10-
h) Avoid destructive updates if possible. The irept has
11-
constant time copy.
3+
- Use 2 spaces indent, no tabs.
4+
- No lines wider than 80 chars.
5+
- If a method is bigger than a page, break it into parts.
6+
- Put matching { } into the same column.
7+
- Do not use namespaces.
8+
- Prefer use of 'typedef' insted of 'using'.
9+
- Prefer use of 'class' instead of 'struct'.
10+
- User defined type identifiers have to be terminated by 't'. Moreover,
11+
before 't' may not be '_'.
12+
- Avoid new/delete, use containers instead. In other words, do not perform
13+
heap operations directly.
14+
- Write type modifiers before the type specifier.
15+
- Do not use 'm_' prefix nor '_' suffix for names of attributes of structured
16+
types.
17+
- Avoid destructive updates if possible. The irept has
18+
constant time copy.
19+
- Avoid unnecessary #includes, especially in header files
20+
- We allow to use 3rd libraries directly. No wrapper matching the coding rules
21+
is required. Allowed libraries are: C++ standard library.
22+
- No "using namespace std;".
23+
- Use instances of std::size_t for comparison with return values of .size() of
24+
SLT containers and algorithms, and use them as indices to arrays or vectors.
25+
- Prohibited stuff from the standard library: ??? TODO!
1226

1327
Architecture-specific code:
1428

15-
a) Avoid if possible.
16-
b) Use __LINUX__, __MACH__, and _WIN32 to distinguish the architectures.
17-
c) Don't include architecture-specific header files without #ifdef ...
29+
- Avoid if possible.
30+
- Use __LINUX__, __MACH__, and _WIN32 to distinguish the architectures.
31+
- Don't include architecture-specific header files without #ifdef ...

0 commit comments

Comments
 (0)