Subject Error reporting in new API
Author Adriano dos Santos Fernandes
Hi!

In the past, discussion of a new API ended with flame-wars on how the
API should report errors.

I do want present a technique for error reporting that:
1) works for C and any non-C++ languages in traditional ways (i.e.
checking states after calls)
2) works (very friendly) in C++ throwing exceptions
3) works in mixed C++ compiler environments where API was compiled with
one compiler and user application with another - at least in theory,
with compilers implementing COM-like ABI

The technique used is "throw in destructor", that is only problematic
during stack unwind. But the API is expected to never throw, so that is
not a problem.

I've just uploaded a demonstration code to this group.

http://f1.grp.yahoofs.com/v1/oPJSR63vuRHcY0lMpC_OJfKb1Epxh4Fah2aBW7EQd85CeccxLslCjgFEkXtuiZgULI0w0qXXg5z8UHaha5uHA7EJtkTU2NosW8DsrA/ErrorApi.zip


Adriano