On 02/08/2012 14:25, ext [email protected] wrote: > On 02/08/2012 12:55, ext Thiago Macieira wrote: >> On quinta-feira, 2 de agosto de 2012 17.32.36, >> [email protected] wrote: >>> "the compiler can eliminate the mechanics of tracking the >>> lifetime of certain unwindable objects in such a function, and >>> significantly reduce the code size". >> >> That's in the caller. >> >> The problem is in the callee. The function that got the throw() >> decoration gets more code to verify that it is not leaking any >> exceptions. > > That doesn't make any sense, and certainly not in release builds, > that you in a function marked as not going to throw an exception > generate code to _really_ make sure you don't? And if that was the > case, you certainly wouldn't proclaim that it "significantly reduces > the code size", since you would increase the size of every callee > marked as noexcept, only to save a little bit in the caller > function.
I realize now that we have been talking past each other. You were talking about the reasons for why "throw()" has been deprecated from the standard (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3051.html), while I was talking about MSVC's specific implementation (http://msdn.microsoft.com/en-us/library/wfa0edys(v=vs.110).aspx). They don't match. "Visual C++ departs from the ANSI Standard in its implementation of exception specifications." ... "If a function is marked with throw(), the Visual C++ compiler will assume that the function does not throw C++ exceptions and generate code accordingly." ... "if a function does throw an exception, the program may not execute correctly." "It is the equivalent to using __declspec(nothrow)." ... (docs for __declspec(nothrow)): "the compiler can eliminate the mechanics of tracking the lifetime of certain unwindable objects *in* such a function". This tells me that MSVC's implementation of throw() == noexcept(true) for all intents and purposes, and we can use that in Qt. -- .marius _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
