4 ms·
I don't think braces solve that particular problem: if (null != foo); { bar(); }
by thedufer 13y ago
I don't think braces solve that particular problem:
if (null != foo);
{
bar();
}
- pavanky 13y agoI agree. This is we do if (null != foo) bar(); or if (null != foo) { bar(); }
- jbert 13y agoIt does if you use the One True Brace Style: http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS since your eyes would flag: if (null != foo); { bar(); } as badness. [edit: correct } to {, ta]
- georgemcbay 13y agoAs someone who programs in Go a lot these days, that line (I assume you meant the first curly to be { and not }) looks less obviously wrong than it would have in the past when I did more C/C++ programming. Because I've gotten used to Go's support for short assignment in an if, the semi doesn't look completely out of place there (though the construction here is not valid Go either).
- fyi80 13y agoFortunatly for Go, `if (1); {}` will not compile.
- deleted 13y ago[deleted]