GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Ne10 Coding Style Ne10 Coding Style
Joe Savage edited this page
Though Ne10 does not enforce code style particularly strictly, there are some rough syntactic rules and semantic suggestions which we encourage contributors to follow in order to maintain some consistency within the codebase. Failing to abide to the more important parts of these guidelines — for example, by indenting your code with two spaces — wastes code reviewers' time, and will likely result in having to spend more time correcting the code than it would have taken to simply write it properly in the first place!
Ne10 roughly follows the C coding style used in the Linux kernel, with a few notable exceptions, including:
Some examples of the style of C code used within the project follow. /** * @brief This function does X, Y, Z (this is a function description doxygen comment) * @param[in] arg a short description of the `arg` parameter * @return a short description of the return value * * This is a longer description of the function, detailing its nuances and intricacies, * of which it may have a great number. */ void some_function (int arg) { int i; // This is a comment /* This is also a comment */ return 0; } if (a > 5) { some_function_call (params); } else if (abs (a) < 5) { const int *ptr = b; // We prefer "const int *" to "int const *" here if (!b) { while (some_condition) { ptr++; } } return ptr; } else { // Do something } #define FOO #define NE10_ADD1(X) ((X) + 1) #define NE10_CPX_ADD(Z,A,B) \ do { \ Z.r = A.r + B.r; \ Z.i = A.i + B.i; \ } while (0) The format of assembly files is less consistent within the project, but each should use an internally consistent formatting style. Currently, the assembly files used within Ne10 roughly abide to the following recommended format:
An example snippet of assembly code with this format follows. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |