2 ms·
Yes, but from what I understand this bug is more commonly introduced in code that is being updated. Notice that I said "avoided", not "fixed". That is because
by gravypod 11y ago
Yes, but from what I understand this bug is more commonly introduced in code that is being updated.
Notice that I said "avoided", not "fixed". That is because I am rather focused on making code that is maintainable.
I posted this original comment to have a dialogue about something I include in my programming practices. I wanted to see how other people viewed this as a development technique.
- MichaelBurge 11y agoYou didn't say it explicitly, but your original comment came off more like "This option is unnecessary and should be removed from gcc, since we can simply enforce a style of using curly braces everywhere" C doesn't do this, but I like this feature from Perl for single-statement checks: return if is_red($traffic_light); return unless is_green($traffic_light); In C, I usually put the early returns on their own line without curly braces, but place them all together at the start of the function to make it easier to spot inconsistencies.
- kbenson 11y agoI love that feature of Perl, and to be explicitly clear to those that are unfamiliar with it, Perl does not allow unbraced single line if's in the normal sense (pre-conditional ifs), and does not allow braced post-conditional ifs. For example, these are valid: if ( $foo ) { bar(); baa(); } quux() if $foo; And these are not: if ( $foo ) bar(); { bar(); baz(); } if $foo;