ECE 209 Coding Style Requirements
All submitted code should strive to adhere to Sections 5.1 - 5.4 of the GNU Coding Standards. In order to get full "style" points, the code must comply with the following:
- Each file must have a comment header, giving a brief summary of the contents of the file and giving the author's name and the date. For the file with a main() function, the header must contain instructions for running the program.
Example:
/* countChar -- find and count a character in a file.
*
* Usage: countChar <filename> <character>
* The program will print the number of occurrences of <character>
* in the file designated by <filename>.
*
* G. Byrd, March 2007
*/
- Each function must be preceded by a comment that describes the function.
- There must be at least one blank line between every function definition.
- Declarations of functions and global variables must come before any function definition.
- Every new block must be indented by at least two spaces. In other words, each line after an opening "{" must be at least two spaces to the right of previous lines, until the closing "}". The closing brace must be on a line by itself. Example:
if (a == b) {
x = y;
z = x - 3/c;
}
Assignments
Programs are due at 11:00pm on the designated day. There will be no extensions, except for university-excused absences.
Giving credit
These requirements were written by Greg Byrd of NSCU and
are the same as those of the big ECE 209
section taught on the Raleigh campus.