I'm torn on this question here.
It's basically asking whether it's a good idea to have the opening brace of a code block on its own line or as part of the
if/while/etc line that the block belongs to.
Now normally I wouldn't worry too much but the question specifically asks for the reasons why one way is better than another.
And having gotten hit in the head this morning by my 6yo son's hockey stick, I'm feeling unusually philosophical.
It appears to me that this is no different to a question like:
I have some data which is mostly sorted, which sort algorithm is fastest when adding small sets (three elements or less) to it, and why?
Now that either has no single 'right' answer since there are a myriad of sort routines that would be up to the task, or it has a right answer depending on the pros and cons given in the answer. I think I would probably let that one go and see what answers were generated since algorithm selection in specific cases is of interest to me.
But I can't really discern a difference between that and:
Is the opening brace for an
ifstatement better on the same line or next line, and why?
but that may just be the concussive effects from that curved indentation in the side of my head.
I'd be inetersted in knowing what people think about it.