Re: bug in function strtoint, on Windows OS won't report ERANGE - Mailing list pgsql-bugs

From Tom Lane
Subject Re: bug in function strtoint, on Windows OS won't report ERANGE
Date
Msg-id 4019549.1709653331@sss.pgh.pa.us
Whole thread Raw
In response to bug in function strtoint, on Windows OS won't report ERANGE  (Miron Berlin <mironatpro@hotmail.com>)
List 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 by date:

Previous
From: Said Krikess
Date:
Subject: Issue with PostgreSQL 11 RPM Package Availability
Next
From: Alexander Lakhin
Date:
Subject: Re: BUG #18351: VACUUM FULL fails with error: missing chunk number 0 for toast value XXX