Home CS439


CS439: C Style Guide

Programming is not a dry mechanical process, but a form of art. Well written code has an aesthetic appeal while poor form can make other programmers and instructors cringe. Programming assignments will be graded based on style and correctness. Good programming practices usually include many of the following principles:

General Programming Style

Specific Guidelines

Code Layout


Comments

Naming Conventions



Checking Return Values

System calls and library functions provide important information to the programmer via return values. You MUST check all return values and handle errors reasonably.

Working in a Pre-existing Infrastructure

When working in a pre-existing infrastructure, your goal is uniformity. If the existing code base is using 3 space indentation, then you do, too, regardless of your personal preferences. If the existing infrastructure begins all functions with the prefix "func", then you do, too. Uniformity is the best way to ensure the code is readable and maintainable.