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

And really, the main benefit to not assigning a value in the declaration is to get the compiler to tell you if there is a code path that misses an assignment.

    int i;
    if (foo || bar)
        i = 1;
    else if (baz) {
        if (!quux)
            goto fail;
        i = 2;
    }

    printf("%d", i); // not all code paths assign a value


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

Search: