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

>Unfortunately, I often see solutions abusing exceptions:

    int sum = 0;
    for (int x : a) {
        try {
            sum += get_positive_value(x);
        } catch (...) {
            sum += -x;
        }
    }
you need to fire whoever does that...


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

Search: