On Saturday, 27 September 2014 at 09:32:19 UTC, Jacob Carlborg wrote:
On 2014-09-27 02:47, Manu via Digitalmars-d wrote:

Initialisation logic often looks like this, and I buy the value of exceptions in this case. However, I've never successfully implemented it yet though, because the calls that create code like that always seem to be extern-C calls in my experience... :/

Perhaps you should wrap those call an throw an exception.

I often do something like this:

proc(someFunc(a, b, c));
proc(anotherFunc(d, e, f));

Where proc() processes the return value and conditionally throws on error. You really need one such function per API, but that's not a big deal. You can kind of get away with macros if you're using C, but all they can really do is jump to an expected Lerror label.

Reply via email to