DEV Community

Discussion on: Your most controversial opinion

Collapse
 
jfrankcarr profile image
Frank Carr

I've been kind of back and forth on this.

From coding in C and C++ in the past, I like the security having the braces bring but I also like the brevity of not having to use them. I've kind of ended up in the use brackets camp because, in the long run, it makes the code easier to read for more people.

Collapse
 
josegonz321 profile image
Jose Gonzalez

Hmm, what type of security do they provide to you? I’m interested now :)

Thread Thread
 
elmuerte profile image
Michiel Hendriks

See Paritosh' comment in this thread.

In short:

if (someRatherLongBooleanCheck) 
   doSomething()
if (someOtherRatherLongBooleanCheck) 
   doSomethingElse()
   doNotLookAtMe()
if (imJustHereToDistractYou) 
   andWeAreDone()
Thread Thread
 
zenmumbler profile image
zenmumbler

Or for a concrete example, the "goto fail" bug from a couple of years ago:

imperialviolet.org/2014/02/22/appl...