Re: bug in function strtoint, on Windows OS won't report ERANGE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: bug in function strtoint, on Windows OS won't report ERANGE
Дата
Msg-id 4019549.1709653331@sss.pgh.pa.us
обсуждение исходный текст
Ответ на bug in function strtoint, on Windows OS won't report ERANGE  (Miron Berlin <mironatpro@hotmail.com>)
Список pgsql-bugs
Miron Berlin <mironatpro@hotmail.com> writes:
> Functionstrtoint has a bug. It would not report ERANGE on Windows OS compiled with Microsoft Visual Studio compiler.

Have you actually tested that?  AFAICS, the code as given works
perfectly fine on platforms where long is the same width as int.
The lines

    if (val != (int) val)
        errno = ERANGE;

are dead code then (and possibly will be elided by the compiler),
but it doesn't matter because then strtol can be expected to
set ERANGE properly for values outside the int range.

Possibly it'd be worth adding a comment to point this out.

            regards, tom lane



В списке pgsql-bugs по дате отправления: