> > >> Contrast that with the known_host functions. There the return code is a 
> > >> result, not an error. You call those functions fully expecting to get 
> > >> any of the possible values returned.
> > >
> > > I understand these are technically not errors per-say, but that doesn’t 
> > > mean I agree with their values being the same.
> >
> > Would you feel different if the function did a calculation that returned a 
> > number? Or checked something and returned a boolean?
> >
> > Both those would return values that overlapped with the error codes. But 
> > they aren't error codes, so you presumably wouldn't care. The known_hosts 
> > functions are no different.
> 
> I've thought about this some more and I think I understand where the 
> confusion arises. You are understandably assuming that 
> libssh2_knownhost_check returns error codes when it hits an error (a real, 
> unexpected, exception-type failure; not just 'not found'). It doesn't. It 
> actually return there result FAILURE which means you should call 
> libssh2_session_last_errno function to get the real error code (for example 
> LIBSSH2_ERROR_ALLOC).
> 

There is no confusion.  I simply do not like conflicting static defined result 
values.  This scenario is different than returning a bool or a random value, 
these are defined values, that do not change and overlap.  It’s not how I would 
personally do it, perhaps it’s OK with you, that’s OK, we can agree to disagree.

Will
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to