vivkin/gason

Implicit fallthrough?

r-barnes opened this issue · 2 comments

Is there supposed to be a fallthrough on this line?

        *endptr = s++;
        switch (**endptr) {
        case '-':
            if (!isdigit(*s) && *s != '.') {
                *endptr = s;
                return JSON_BAD_NUMBER;
            }
        // Should I fallthrough here?
        case '0':
        case '1':
        case '2':
        case '3':

Yes. Then call to string2double(*endptr...) where '-' handled properly. This cases [-0-9] for parsing numbers

Thanks, @vivkin . I've put up #41 to make the fallthrough explicit (works for C++17 and up).