On 2009-01-25 14:39:52 -0500, Walter Bright <newshou...@digitalmars.com> said:

I did think of making all functions that are extern(C) automatically nothrow, but was concerned that it would result in a lot of bugs and broken code from ones that did throw.

It's better that way, because it allows you to write proper wrappers for C++ functions that may throw exceptions. Like this:

        extern "C"
        int _doSomething_wrapper(int value)
        {
                try
                {
                        return doSomething(value);
                }
                catch (const std::exception & e)
                {
                        _d_throw_exception(e.what());
                }
        }

with _d_throw_exception written in D and throwing an exception.

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to