[Mono-list] Class Library coding standards

Sean MacIsaac macisaac@ximian.com
18 Jul 2001 15:44:44 -0400


Hello,

First of all, thanks to everyone who has submitted code.  Things are
coming along very nicely.  Miguel and I are soon going to figure out
what classes we'll need to get the compiler going so that we can put
priority into them (and move the whole tool chain to Linux!)

I'd like to throw out the coding standards we'd like to have in the
class libraries.  There is still some room to maneuver within these
guidelines.  Given that, please follow the style already in a file if
you edit it.

* We'd like to see 8 space tabs.  If you leave the tab character, that
is also fine.

* The opening brace following a namespace, class, struct, enum, property
or flow control unit should be at the end of the declaration line.

* The opening brace for a function should be on the line following the
function.

* Please use white space around operators and a space between function
names and their parameters.

Example:

namepace CIR {
        public class BoolLiteral : Literal {
                bool val;
                
                public BoolLiteral (bool val)
                {
                        this.val = val;
                }

                override public string AsString ()
                {
                        return val ? "true" : "false";
                }

                public bool foo ()
		{
			if (bar (5) > 10) {
				val = false;
				return false;
			} else {
				val = true;
				return true;
			}
		}	

                public bool literal {
                        get {
                                return val;
                        }
                        set {
                                val = value;
                        }
        }
}