View Single Post
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 01-16-2010 , 13:01   Re: [TUT] Code Styling & Good Programming Habits
Reply With Quote #41

Yes, I do, here's a sample:
PHP Code:
main() {
    new 
barbaz 29;

    for (new 
0bazi++) {
        
bar *= baz i;
    }

    new 
arr[32];

    
foo(barbazarrarr);
}

public 
foo(abc[], d[32]) {
    
assert((sizeof(c)-1) > 0);

    switch(
a) {
        case 
1: {
            
+= 10;
        }

        case 
2: {
            
+= 13;
        }

        default: {
            
-= 2;
        }
    }

    if (
0) {
        
abs(b) + a;
    } else {
        
-= a;
    }

    
c[0] = / (d[12] - d[10]);
    return 
d[31];

To make it simple: I use K&R convention, with one exception: function's starting bracket in the same line of the function signature.

Last edited by Seta00; 01-16-2010 at 13:04.
Seta00 is offline