Iximiel / plumed2

Development version of plumed 2
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Removed a should from Exception.h #43

Closed Iximiel closed 6 months ago

Iximiel commented 6 months ago
Description

At first look this may look like an aestetic change. But I encoundered a case i which the if (!(test)) plumed_error() << PLMD::Exception::Assertion(#test), the plumed_dbg_massert macro expansion with NDEBUG, is not optimized away, and this patch I think is the least invasive thing to do:

if constexpr(false) is guaranteed to be evaluated at compile time, so that the rest of the line is ignored.

I think helps in improving the code optimization after inlining a function, at least that is what I think it happened in my case

Target release

I would like my code to appear in release 2.10/2.9 (this is a single commit, it can be easily rebased on the 2.9)

Type of contribution
Copyright
Tests