Aww crap... did I just start a flame war?!
Erm....
So what about that Haskell 'eh guys? Erm...
*runs and hides*
while(i<50);
{
printf("%i",i++);
}
//Why won't this code do what you'd expect it to do?
Yet everyone still uses that style except (it seems!) me!!
(When I coded that is I haven't done any serious codeing in ages )
Not sure what you're asking here. If you're referring to brace alignment style, people should IMO teach the BSD/Allman style (where the braces are aligned in the same column), as it's superior in both readability and syntactical consistency.
Incidentally, you added an erroneous semicolon in your second example.
Very good! That is the correct answer to the problem!
The mark of an experienced coder
That is the problem with the in-column {}'s - Its very easy to do stuff like that and miss off a semi but still have the code compile and run because it is perfectly valid code.
If you miss off a brace, the compiler will usually throw up at least a warning about an unmatched brace somewhere...
If you're used to it, there are no readability problems - You look for indentation blocks, not tiny curly braces
I don't know what syntactical consistency means...
I use KATE (The KDE editor) to write most of my code - Most IDEs really suck at the resolutions I work at (800x600 - *Much* more comfortable on the eyes for staring at text for long periods.), but KATE handles long-line wrapping very well and intelligently.
At the end of the day, its coder preference, but that can be problematic in a team (Once in uni, we got so hung up about it we wasted time making utilities to switch between the two styles before we actually started working on the project proper!!!
)
void DoSomething() {
int loop=0;
int processed=0;
bool done=false;
while(!done) {
done=StartProcessing(loop, &processed);
if (processed == MaxLimit){ //An unneeded brace...
done=true;
} //... or missing a brace :D
}
}