What coding standards do you follow?

Posted by Mark Szymanski on Stack Overflow See other posts from Stack Overflow or by Mark Szymanski
Published on 2010-06-13T01:57:43Z Indexed on 2010/06/13 2:02 UTC
Read the original article Hit count: 249

I was just curious what coding standards people followed.

I for one use the following:

  • Brackets ALWAYS go on the next line. For instance:
    int main() 
    {
        //Blah...
    }
  • I never use code folding. (Yes my IDE's do support it (Xcode and Eclipse).

  • Put related functions/methods single-spaced, otherwise double space. Here is an example:

    int foo = 0;
    printf("%d",foo);

those are related while these are not:

    printf("Hello, World!");

    return(0);
  • I don't put else statements on the same line as the closing bracket for the preceding if statement.

  • Most of the time in Java if a program needs multiple try catch statements I will just put the whole thing in one try catch.

© Stack Overflow or respective owner

Related posts about coding-standards

Related posts about programming-styles