3 ms·
I used to code like that for a long time so it doesn't bother me too much. Then I started learning Rust (which uses a C-style syntax but makes braces mandatory
by simias 8y ago
I used to code like that for a long time so it doesn't bother me too much. Then I started learning Rust (which uses a C-style syntax but makes braces mandatory ever for single statements) and I started doing it even in C. In hindsight I feel stupid for not doing it earlier, it doesn't add too much noise (at least if you put the opening brace on the same line) and it wards off many potential nasty bugs if you copy code around or use poorly written macros.
- Sean1708 8y agoMy rule has always been that if you're going to write a single line if-statement it should actually be a single line if-statement, i.e. no line break between the condition and the curly bracket.