C Project Style Guide

CS 1323 Honors, Fall 1996

Review this guide for each new project.
New requirements emerge as projects increase in complexity.

Project Document Requirements

Use 8.5x11 paper, written in portrait orientation.

Put your name and the project number at the top of the first sheet.

Staple the sheets together in the upper left corner.

No green-line paper.

No fan-fold paper.

No dot-matrix printers.

No paper clips.

Standards for C Programs

Keep all lines in under 70 characters in length.

Put the opening curly-brace of a function definition
on the same line as the function name, and put the
matching closing brace on its own separate line,
matching the indentation of the function header.

Indent each declaration and statement
in a function definition to a consistent level.

Break multi-line declarations and statements
at operators with low precedence,
commas, or other natural separators, and indent subsequent
lines of the declaration or statement to make the statement
appear to be a single unit and to visually connect its
related component parts.

Use capitalLetters to mark componentWords in
compoundEntityNames. Choose choose descriptive names for
variables.

Avoid mixing literals and conversion specifiers in
the format string of print commands.

Use initialization in declaration statements only for
constant variables.

Precede each function prototype in the .h file for a module with
a brief explanation of the function's effects.

Standards for Session Transcripts

Most projects require you to turn in a transcript of a
session in which
compile and run
your program.
You generate such a session by
issuing the command "script" to Unix before invoking the
compiler, then pressing "control-D" after running your
program.

These actions produce a file named "typescript" containing a
transcript of the session.
Such files may contain backspace
characters, which make the print-out look ugly in spots.
Before printing the typescript file, issue the command "hugs",
load the script "removeBS.hs"
and issue the command "main" to Hugs. This
command will write file named "typescript.cln" in which the
backspaces have be interpreted properly. This file contains no
unsightly backspaces.
Print it instead of the raw transcript file.