Sometimes, when I have a multi-case if, or a very simple for, with only two statements, I will forgo braces, instead using the comma. Is this a bad exploitation of the feature, and is it ugly and bad form? Or is it an acceptable way to save time and space?
For example:
if (something)
b = y, c = z--;
instead of:
if (something) {
b = y;
c = z--;
}
It’s indeed a clever way to use that syntactic feature of most C-like languages.
Personally, I try to stay the least ambiguous as possible when I code, so I always include
{and}in all of myifstatements. It may save time, but I prefer clarity: it doesn’t speed up or slow down the code execution.