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 <[email protected]>:
> On Mon, May 25, 2009 at 2:21 PM, Adrian Chadd <[email protected]> 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
>
>

Reply via email to