What's the correct structure for coding? Where are you supposed to put the braces "{}" at? When and where are you supposed to indent or use blank spaces?
This:
int main(){
cout << "Hello World!";
return 0;}
or this:
int main()
{
cout << "Hello World!";
return 0;
}
The correct way is K&R, of course. 4 spaces, braces together with whatever they open and alone only if they are closing something not followed by else or (do..)while, no spaces after function names but one space after statement names, no spaces inside parens, and one space around binary or ternary infix operators.
The correct way is Anonix, of course. 1 space, braces together with whatever they open and alone onlly if they are closing something not followed by else or do...while, no spaces after function names nor after statement names, no spaces inside parens, and no space around any operators.
>>1
Visit the pedo of wiki and link for "indent styles" - you will find many. Each has its advantages and disadvantes. I prefer two spaces for indentation and braces on their own lines (modified BSD style in emacs, basically).
Name:
Anonymous2008-08-28 22:16
>>14
The ``norm'' for PHP is haphazard spacing with no regard for legibility and no considerations regarding line length.
ANONIX's spacing may be less haphazard, but it's still illegible.
of Image num for the class name deaths kills etc just duplicated for each class Like MyClass and MyClass2 with this method should write the damn thing in C takes about the same amount of time Nevermind That reinvent the wheel again for the 40th time.