From: Tom Lane <tgl@sss.pgh.pa.us>
To: Miron Berlin <mironatpro@hotmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: bug in function strtoint, on Windows OS won't report ERANGE
Date: Tue, 05 Mar 2024 10:42:11 -0500
Message-ID: <4019549.1709653331@sss.pgh.pa.us> (raw)
In-Reply-To: <DM4P223MB0518D09B523522F099A97E2CC0222@DM4P223MB0518.NAMP223.PROD.OUTLOOK.COM>
References: <DM4P223MB0518D09B523522F099A97E2CC0222@DM4P223MB0518.NAMP223.PROD.OUTLOOK.COM>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, mironatpro@hotmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: bug in function strtoint, on Windows OS won't report ERANGE
In-Reply-To: <4019549.1709653331@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox