News for hackers. Stuff that matters.
Re:It is time to unlink the “Backspace” – Browser Back short... by geofft on Saturday August 20, 2016 @07:13PM (#12328695)
An if is just an inconsistent goto, so, yes. if is often a code smell.

For instance, any code like

    x = some_result()
    if is_valid(x):
        do_stuff_with(x)
is indisputably an opportunity for bugs. Better would be some construct like "if let" in Swift or Rust, where you can't use x without the condition. For instance, this was the fundamental cause of Apple's "goto fail" vulnerability: the language / API style required that they check each result and run a conditional branch on their own. (The proximate cause was bad language syntax, but the opportunity for bad syntax shouldn't have been there in the first place.)

There are no comments on this comment yet.