Subject: Re: breaking the ABI (was Re: 'watch' libssh2 on github)

Re: breaking the ABI (was Re: 'watch' libssh2 on github)

From: Alexander Lamaison <>
Date: Fri, 13 Mar 2015 18:25:42 +0000

On 13 March 2015 at 17:56, Will Cosgrove <> wrote:
>> >> 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
> 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.

LIBSSH2_FX_OK, the boolean value FALSE, the NULL pointer and the
unusable socket INVALID_SOCKET are all defined values that share the
value 0. But that's OK because they are totally unrelated.

It not practical, and not necessary, to make sure that all constants
defined in a program exist along a single range, without overlap. Why
would you want to?


Swish - Easy SFTP for Windows Explorer (
Received on 2015-03-13