Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ writing style

Name: vexed 2012-03-25 19:54

When writing code (in C++ particularly), where do you put your curly braces?

ex:
int main()
{

}

OR...

int main(){

}

which do you think is better? clearer? more professional?

Name: Anonymous 2012-03-26 18:38

>>25
Sorry, this thread is about C++ (that's in the title at least), I was thinkng of C. In C, a struct declared within a struct doesn't have inner scope, but the same scope as the outer struct. Curly braces most often mean ``statement list'', except for variable and array initializations, unions/structs and (some say) function bodies. Statement lists introduce a lexical scope for variable and other names. Structs and unions don't.

Opening bracket for function bodies should be in column 0 so you can jump from function to function with [.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List