www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

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

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

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Fri, 13 Mar 2015 16:46:56 +0000

On 13 Mar 2015 16:18, "Will Cosgrove" <will_at_panic.com> wrote:
>>
>> >> we have a function like errorMessageFromCode(int code), the _code_ is
the code coming from any o’l libssh function call.
>> >
>> >
>> > But that's the mistake. All libssh2 functions don't return the same
error code set. The libssh2_knownhost*() functions for example only return
error codes in the LIBSSH2_KNOWNHOST_CHECK_* series.
>>
>> If I may weigh in here, the known_host return codes aren't error codes
at all. That's where the misunderstanding has occurred.
>>
>> Most libssh2 return codes are indeed errors. You can think of them as
exceptions, in a language that has that feature. Apart from EAGAIN, you
never call a libssh2 function expecting to recieve one of those errors.
>>
>> 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.

Asked

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2015-03-13

the libssh2 team