News for hackers. Stuff that matters.
Re:Apple's SSL/TLS bug by jcurbo on Saturday February 22, 2014 @10:35AM (#7282334)
Funny thing is, I was finally looking at Rust the other day and thought, hey, that's nice that if statements are forced to have braces, I never liked one-liner if statements in C. And here we have a perfect example of what can happen with the brace-less if statements.
Re:Apple's SSL/TLS bug by Jayschwa on Saturday February 22, 2014 @01:17PM (#7282938)
Yeah, it seems like this is something many newer languages are requiring, which is good. Go requires braces as well.
Re:Apple's SSL/TLS bug by lmm on Saturday February 22, 2014 @02:25PM (#7283214)
Requiring braces is the wrong solution to the problem. It's the indentation that misleads here; indentation is what people look at to see what's part of which if, so have the language look at the same thing, like Python does.
Re:Apple's SSL/TLS bug by emmelaich on Saturday February 22, 2014 @06:28PM (#7284119)
Indeed, but I wonder if indenting would have helped here.

Two gotos immediately after one another at the same indentation level is obviously wrong by visual inspection.

Proper indentation might have led the casual viewer to think that the code was actually ok!

Re:Apple's SSL/TLS bug by rwallace on Saturday February 22, 2014 @08:38PM (#7284575)
That's the thing - with an indentation-based syntax, the code would have been okay! The second goto would have been part of the if statement, so it would have had no effect beyond the aesthetic.
Re:Apple's SSL/TLS bug by micro-ram on Saturday February 22, 2014 @07:38PM (#7284397)
I use Astyle to enforce both braces and indentation automatically.

http://astyle.sourceforge.net/