Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Java (if it had gotos) would not have compiled this code because it doesn't allow unreachable code.


In the Apple SSL bug, a goto statement works much like a function call or a throw in Java. Here's a Java example that compiles without warning and has the same flaw:

    public static void foo() throws Exception {
        throw new Exception();
    }

    public static int bar() throws Exception {
        int x = 0;
        if(x == 1)
            foo();		
            foo();
        x++;
        return x;
    }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: