Actually, it should probably be 1 vs 0; -1 still evaluates to true if
you go (if func()).
I think the last few hours of fixing bad C and putting in error
checking messed me around a bit. I just wrote a quick bit of C to
double-check.
(Of course in C++ there's native bool types, no? :)
Sorry!
Adrian
2009/5/25 Kinkie <gkinkie_at_gmail.com>:
> On Mon, May 25, 2009 at 2:21 PM, Adrian Chadd <adrian_at_squid-cache.org> wrote:
>> int
>> isUnsignedNumeric(const char *str)
>> {
>> for (; *str; str++) {
>> if (! isdigit(*str))
>> return -1;
>> }
>> return 1;
>> }
>
> Wouldn't returning 0 on false instead of -1 be easier?
> Just a random thought..
>
>
> --
> /kinkie
>
>
Received on Tue May 26 2009 - 00:36:56 MDT
This archive was generated by hypermail 2.2.0 : Tue May 26 2009 - 12:00:02 MDT