Hacker News new | ask | show | jobs
by qeorge 5348 days ago
Gotcha. I'm not an OS guy, and didn't know that convention. Thanks!

Dumb question though:

If rehash can only return -1 or 0, won't

   if(rehash(H))
always fail?
2 comments

Dumb question though...

There's no such thing as a dumb question, only people too dumb to take every available opportunity to learn. ;-)

In C, "if (foo)" means "if (foo != 0)" if foo has integer type, so that line means "if (rehash(H) != 0)" or (since rehash only returns 0 or -1) equivalently "if (rehash(H) == -1)".

Thanks so much Colin, I'm learning a lot today. :)
The reason for the convention is that there's often only one form of success, so 0 suffices, but there may be many causes of failure.