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

Inizio della pagina
Delete this message
Autore: ph10
Data:  
To: Ralf Junker
CC: pcre-dev
Oggetto: Re: [pcre-dev] PCRE2 SVN 463 strtoul() return value comparisons
On Mon, 14 Dec 2015, Ralf Junker wrote:

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


Good!

> 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


I'm afraid I don't understand. uli >= ULONG_MAX would not work on a
system (such as mine) where the check needs to be uli > UINT32_MAX
because ULONG_MAX is 18446744073709551615UL but UINT32_MAX is
4294967295U.

Philip

--
Philip Hazel