Niagara Coding Guidelines

There are many coding and and design guidelines for Niagara that are on dead trees and not available online yet.


C and C++ Style

As a starting point, everything is indented with normal 8 character tabs, end braces are on their own line, and start braces are at the end of the opening line. For now, a trivial example --- that will probably look weird depending upon the tab stops in your browser:

#include 

int main(int argc, char **argv)
{
	int		i;
	unsigned	u = 0;

	for (i = 0; i < argc; i++) {
		if (i & 1) {
			printf("odd arg %d == %s\n", i, argv[i]);
		}	
		else
			printf("even arg %d == %s\n", i, argv[i]);
	}

	switch (argc) {
	case 3:
		u = 1;
		/*FALLTHROUGH*/
	case 2:
	case 1:
		printf("u = %u\n", u);
		break;
	default:
		printf("%s: unknown args %d\n", argv[0], argc);
		break;
	}

	return 0;
}				

Emacs Indentation

If you use emacs to write code, there is a Niagara C++ mode setup for people to use so that everyone will be using the same indentation. To use this add the following lisp to your .emacs file:

; Use Niagara C/C++ indenting and formatting.
(load-file "/p/niagara/s/emacs.el")

Bolo Documents Bolo's Home Page
Last Modified: Thu Feb 28 15:02:04 CST 2002
bolo (Josef Burger) <bolo@cs.wisc.edu>