|
CodingStyle
You'll find the coding style/conventions for Uhura here. IntroductionThis project doesn't really use any popular style like K&R, GNU or Java conventions. The following code section is to demonstrate the style, and not to be proper code. DetailsIndentationUse spaces, 4 character wide, not tabs. void foo() {
Console.WriteLine("Uhura");
}Vertical AlignmentUse vertical alignment for similar or related elements int i[5] = { 1, 2, 3, 4, 5 };
char c[3] = { 'a', 'b', 'c' };
float f[2] = { 1.5f, .2 };SpacingUse spaces to for arithmetic, separation and controls. void Counter(int count) {
for (count = 0; count < 10; count++)
count = count * count + count;
}NamingUse of Microsoft Naming Guidelines for a consistent style. No Lefthand ComparisonIn a comparison place constant on the right side. if (condition == false) { /* ... */ }Control StructuresCurly brackets are placed after control flow construct switch (level) {
case One:
start_level(1);
break;
case Two:
start_level(2);
break;
}ListsLists items will be placed in separate lines, if they get to long. int foobar(int very_important_int,
int another_very_important_int,
double now_a_double);CommentsUse commands to clarify code, but not how it works. Use C++ style comments for short one line comments, and C style comments for multiline // single line comment /* * multi line comment */ Length of LineTry to keep the line 80 chars short. If it helps for readability break the line, otherwise use a long line. |
Sign in to add a comment