The Lakos Rule says that methods that only methods with wide contracts should 
be noexcept. That is, if your method has a precondition, it should not be 
noexcept.

This is apparently predicated on the fact that the preconditions will be 
implementable as C++ contracts some time in the future and that some compilers 
or compilation modes may turn contract verifications into runtime checks. 
Moreover, said checks can be implemented by throwing an exception indicating a 
contract violation. Alternatively, an application could replace the Qt 
assertion handler with one that throws (which is currently not possible 
because qt_assert is noexcept, therefore this replacement is not supported).

I'd like to request Qt code not obey that rule. In my opinion, it's a defect 
in the contract implementation rather than on Qt code. The *pre* condition 
indicates something that must be true before the method is called and 
therefore the method's own noexcept specification does not apply *yet*.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCAI Platform & System Engineering

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to