18-348 Coding Style Guidelines

General coding style guidelines:

  1. Each file shall have as a minimum the following components:
  2. Programs shall make use of the following good practices:
  3. Programs shall refrain from:

Assembly-Specific Guidelines:

  1. Each procedure shall provide as a comment a "picture" or other summary of stack contents during the main execution portion so programmers can track where variables are with respect to the stack pointer or frame pointer.
  2. Called subroutines are responsible for saving and restoring all registers in calling program, except those documented as being used for parameter passing
  3. Subroutines shall be followed by a whole line comment that indicates the name of the subroutine, for example "; routine MyProcCall ends here"
  4. The following items shall always begin in the same column (each type begins in the same column, but different types might begin in different columns:
  5. High-level comments may begin at column 1 or at the same column as assembly instructions.

C-Specific Guidelines:

  1. Each program shall have an identically base-named ".h" and ".c" file. The .h file shall have header information and the .c file shall contain the code implementation.
  2. C++ constructs can be used to the extent supported by course tools (e.g., use of "//" for whole-line comment)