[Development] Proposal: adding Q_DECL_NOEXCEPT to many methods

marius.storm-olsen at nokia.com marius.storm-olsen at nokia.com
Thu Aug 2 19:32:36 CEST 2012


On 02/08/2012 12:19, ext Thiago Macieira wrote:
> On quinta-feira, 2 de agosto de 2012 17.15.26, marius.storm-olsen at nokia.com
> wrote:
>> So, perhaps we can identify the cases where they are similar and use
>> that with MSVC until proper noexcept()/noexcept(<type>) support is provided?
>
> Yes. I can identify where they are similar: nowhere.
>
> If you add it, the function with the throw() specification will *add* code to
> check all exceptions. That's why throw() is deprecated.

Huh? The documentation explicitly says
"    void MyFunction(int i) throw();
tells the compiler that the function does not throw any exceptions. It 
is the equivalent to using __declspec(nothrow)."

So, i.o.w. throw() == __declspec(nothrow), which in turn means

"the compiler can eliminate the mechanics of tracking the lifetime of 
certain unwindable objects in such a function, and significantly reduce 
the code size".

So no, throw() will effectively remove all checking for exceptions.

Using "throw(...)" *will* add code to check all exceptions, but that's 
not what we were talking about.

-- 
.marius


More information about the Development mailing list