Changes between Version 31 and Version 32 of CodingStyle
- Timestamp:
- Jul 14, 2018, 6:57:27 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodingStyle
v31 v32 9 9 * If code is repeated, factor it out and make it into a function. 10 10 * If a function becomes longer than 100 lines or so, split it up. 11 * If a file is becoming 'landfill' , split it up.11 * If a file is becoming 'landfill' (unrelated stuff), split it up. 12 12 * C++ `.h` files often contain both interface and implementation. Clearly divide these. 13 13 14 14 === Error codes === #error-codes 15 15 16 * (Almost) all functions should return an integer error code. 17 Nonzero means error. See [source:boinc/lib/error_numbers.h lib/error_numbers.h] for a list of error codes. 18 The only exception to this is PHP database access functions, which use the mysql_* convention 16 Most functions should return an integer error code. 17 Nonzero means error. See [source:boinc/lib/error_numbers.h lib/error_numbers.h] for a list of error codes. 18 Exceptions: 19 * PHP database access functions, which use the mysql_* convention 19 20 that zero means error, and you call mysql_error() or mysql_error_string() to find details. 20 * Calls to functions that return an error code should check the code. 21 Generally they should return non-zero on error, e.g.: 21 * Functions that return whether a condition holds; such functions should have 22 descriptive names like `is_job_finished()`. 23 * Functions that return a number or other type, and for which no errors are possible. 24 25 Calls to functions that return an error code should check the code. 26 Generally they should return non-zero on error, e.g.: 22 27 {{{ 23 28 retval = blah();