Almost all the code I've seen until now uses the following style for curly braces:
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
Visual Studio also defaults to this. However I have read Code Complete 2nd edition and Steve McConnell argues against this style. "Avoid unindented being-end pairs (...) Although this approach looks fine, it (...) doesn't show the logical structure of the code. Used this way, the begin and end aren't part of the control construct, but they aren't part of the statements after it either." Steve McConnell recommends using the pure block style, which emulates Visual Basic (where there's no curly braces):
void swap(int &a, int &b) {
int temp = a;
a = b;
b = temp;
}
or this (begin-end block boundaries):
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
Although I tend to agree with McConnell's reasoning, all the books I read, the classes I attended, and Visual Studio, use the first style, so I find it a bit weird. What do you think?
People defending trillion dollar companies and their decisions is hilarious! They don't owe us anything and nor should we owe them anything either! They've taken the mick and shafted gamers for too long! Consume consume consume and be happy and broke!
What a time to be alive! Very soon they will say you can't even buy consoles you can only rent and eventually no doubt it will be cloud only! Microslop are partly responsible for this themselves. They pushed AI so hard it hurt gaming and gamers but then again after months of love bombing from Trasha Sharma the rug pull was inevitable. More of the same after the tokenistic fan service gestures of late!
I think you will find it has been well documented across multiple media platforms the many reasons for the fall of destiny which supports the reasons i give above, my opinion is that is what caused the most damage to the company as they stopped being a gaming company and pushed a political narrative, look how damaging the dei road was for bud light, stocks crashed multiple resignations and job losses over a box ticking exercise, when decisions are made not to better something but to instead box tick and deliver something that the vast majority didnt ask for then you will get kick back and it normally has a massive financial impact
An oldie but a goodie, we used to punish people in the office who didn't lock their computers, by either doing the above or changing their desktop wallpaper to a reclining David Hasselhoff
Question
Andre S. Veteran
Almost all the code I've seen until now uses the following style for curly braces:
void swap(int &a, int &b) { int temp = a; a = b; b = temp; }Visual Studio also defaults to this. However I have read Code Complete 2nd edition and Steve McConnell argues against this style. "Avoid unindented being-end pairs (...) Although this approach looks fine, it (...) doesn't show the logical structure of the code. Used this way, the begin and end aren't part of the control construct, but they aren't part of the statements after it either." Steve McConnell recommends using the pure block style, which emulates Visual Basic (where there's no curly braces):
void swap(int &a, int &b) { int temp = a; a = b; b = temp; }or this (begin-end block boundaries):
void swap(int &a, int &b) { int temp = a; a = b; b = temp; }Although I tend to agree with McConnell's reasoning, all the books I read, the classes I attended, and Visual Studio, use the first style, so I find it a bit weird. What do you think?
Link to comment
https://www.neowin.net/forum/topic/630296-curly-braces-placement-and-indentation/Share on other sites
63 answers to this question
Recommended Posts