[petsc-dev] wrong PETSc code, please read the PETSc style guide

Jed Brown jedbrown at mcs.anl.gov
Mon Sep 17 20:38:41 CDT 2012


On Mon, Sep 17, 2012 at 8:27 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

> So it is ok to do  if (fl == 0.0)   but not (!fl)?  How are they different?


It means the wrong thing in C++. Specifically, it tries to convert the
number to bool since there is no std::complex<T>::operator!(T), but
std::complex does not provide a conversion to bool either. This produces
errors like

error: invalid argument type 'std::complex<double>' to unary expression
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120917/074d1561/attachment.html>


More information about the petsc-dev mailing list