[getdns-api] getdns_return_t for destroy methods
ngoyal at verisign.com
Sun Mar 9 13:45:31 MST 2014
Here's an attempt:
getdns_return_t getdns_context_destroy(struct getdns_context* context);
Returns GETDNS_RETURN_GOOD if the context was successfully destroyed. In the event that the context cannot be destroyed, GETDNS_RETURN_GENERIC_ERROR is returned. Some implementations may return this if getdns_context_destroy is called within a getdns_callback_t.
From: Paul Hoffman [paul.hoffman at vpnc.org]
Sent: Sunday, March 09, 2014 4:02 AM
To: Goyal, Neel
Cc: getdns-api at vpnc.org
Subject: Re: [getdns-api] getdns_return_t for destroy methods
On Mar 9, 2014, at 1:48 AM, Goyal, Neel <ngoyal at verisign.com> wrote:
> Not dense at all! In fact, you're right on point. Basically, a return code will enforce our ability to tell them "don't do that". We can't control how a user is going to use our API, or when they'll make the necessary calls, so we just want to cover our bases and let them know they're doing something wrong in a way that doesn't result in a crash.
Ah, that wasn't clear.
The folks who did the original design explicitly asked that any function that has no return information use "void". I hear you asking for a possible return action of "you're hosed and are probably about to die unless your code can recover from this". I would tend to believe that "void" is much clearer semantically. If you really want your return code, I would want to first see how you would document it. I suspect that your documentation will be confusing, but am open to listen.
More information about the getdns-api