Metropoli BBS
VIEWER: coding.std MODE: TEXT (ASCII)
These are the coding standards I am using. If you make some changes to the
code, please attempt to follow these rules.

Gershon Elber

gershon@cs.utah.edu

------------------------------------------------------------------------------


GENERAL
-------

	Code should not exceed column 80. If the code is going to "look"
    better with more that 80 columns it is allowed but should be restricted
    as possible.

NESTING
-------
	Nesting of all expressions is by 4 spaces. Tabs used are 8 spaces.

COMMENTS
--------

	Function comments will have the following form:

/*****************************************************************************
* Comment body.								     *
*****************************************************************************/

	Internal comments will be aligned to the right to column 80 if the
    are commenting expression in the same line:

	i %= 2;						       /* Is i even? */

	Comments that explains the following block, will be left aligned as
    the block. The comment does not need to be right aligned to column 80 as
    well.

BLOCKS
------
	Blocks starts with '{' and ends with '}'. If the block is beginning
    of procedure then it will start with '{' at column 1 and end at column
    1 with '}'. Otherwise it will start with some expression as for/if/while
    etc. in the nesting form:
    expression {
	.
	.
	.
    }

FOR
---
	for (x = 0; x < 10; x++)

    or
	for (x = 0, i = 1;
	     x < 5;
	     x++, i--)

	The body of the for loop can be in the same line where the ')' is
    if it has only one expression. Otherwise the ')' will be followed by
    '{' and the body will start in the next line nested 4 space deapper:

	for (....) x = sin(j);
    or
	for (....) {
	    x = y / j;
	    y = j + 2;
	}

WHILE
-----
	while (x > 0) x--;		/* Use x = 0 stupid! */
    or
	while (x > 0 && y > 0) {
	    x -= 4;
	    y -= 4;
	}
    or
	while (x > 0 &&
	       x < 5)
	    x /= 2;


IF
--

	if (x > 0) x = -x;
    or
	if (x > 0 && y > 0) {
	    x = -x;
	    y = -y;
	}
    or
	if (x > 0)
	    x = -x;
	else
	    x /= 2;
    or
	if (x > 0)
	    x = -x;
	else if (x < -100)
	    x /= 20;
	else
	    x /= 2;


	Note that if the if expression has else part both bodies will be
    aligned 4 space deep (The body of the if part can not be in same line
    as the if and must be aligned with the else body).


SWITCH
------

	switch (i) {
	    case 1:
		printf("1");
		break;
	    case 2:
		printf("2");
		break;
	    case 3:
		printf("3");
		break;
	    default:
		printf("Too big");
		break;
	}










[ RETURN TO DIRECTORY ]