less_retarded_wiki

main page, file list, single page HTML, source, report, wiki last updated on 05/28/23

Programming Style

Here we discuss a good programming style (formatting, conventions etc.). Remember that nothing is set in stone, the most important thing is to be consistent and actually think about why you're doing things the way you're doing them. Think from the point of view of a programmer who gets just your source code without any way to communicate with you, make his life as easy as possible.

Recommended C Programming Style

This is our recommendation or perhaps just a suggestion/guide on the C programming style.

if (a == b)
{
  doSomething();
  doSomethingElse();
}
int a = x;
char b = y;

c += 3 * a;
d -= b;

if (c < d)
a = b;

All content available under CC0 1.0 (public domain). Send comments and corrections to drummyfish at disroot dot org.