On Thursday 08 January 2015 23:33:34 Thiago Macieira wrote:
>  * Q_DECL_NOTHROW / Q_DECL_NOEXCEPT - strongly encouraged
> 
> To public functions (all modules); any function in modules compiled with 
> exception (QtCore, QtXmlPatterns, QtConcurrent).
> 
> You probably want Q_DECL_NOTHROW instead of Q_DECL_NOEXCEPT.
> 
> Do not add to functions that:
>  * allocate memory
>  * call functions that may throw, especially user functions
>  * call POSIX cancellation points
>  * have narrow contracts -- that is, you could conceivably add a Q_ASSERT
> on  input parameters
> 
> If the function is an inline template function and the exception depends
> on  the template argument, use Q_DECL_NOEXCEPT_EXPR.

Consensus, I think?

I'd add that having a nothrow move ctor and move assignment operator is a very 
important optimisation for std::vector. User-defined copy ctors and copy 
assignment operators, but also a user-defined dtors (even if empty) inhibit 
the synthesising of move special member functions by the compiler, so remove 
them when you can or manually add the move special member functions, 
preferably with Q_DECL_NOTHROW / Q_DECL_NOEXCEPT_EXPR.

Example changes for both situations:

https://codereview.qt-project.org/121833
https://codereview.qt-project.org/121824

Thanks,
Marc

-- 
Marc Mutz <[email protected]> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to