Re: [pcre-dev] PCRE2 SVN 463 strtoul() return value comparis…

Top Pagina
Delete this message
Auteur: Ralf Junker
Datum:  
Aan: pcre-dev
Onderwerp: Re: [pcre-dev] PCRE2 SVN 463 strtoul() return value comparisons
On 09.12.2015 18:34, ph10@??? wrote:

> On Tue, 8 Dec 2015, I wrote:
>
>> I guess there should be some fiddling around with tests such as
>> (ULONG_MAX == UINT32_MAX) to see what the environment is, and then
>> craft the tests appropriately.
>
> I have updated pcre2test.c along those lines. Is that better?


Yes, the updated pcre2test.c now works for me.

Nonetheless, the implementation seems more complex than necessary. As I
read the docs, simple >= or <= comparisons would be sufficient even
without #if. They work well on my system and I suppose also on yours:

for strtol(): li >= LONG_MAX || li <= LONG_MIN
for strtoul(): uli >= ULONG_MAX

Other than that, all is fine.

Thanks for the update,

Ralf