Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bessel.hpp and gamma.hpp emit MSVC /analyze warning C6326: Potential comparison of a constant with another constant. #853

@StephanTLavavej

Description

@StephanTLavavej

https://godbolt.org/z/jdd9b6ene

#include <boost/math/special_functions/bessel.hpp>

int main() {
    (void) boost::math::cyl_bessel_i(0.0, 0.0);
}

When compiled with MSVC /analyze, this warns:

[...]\include\boost\math\special_functions\bessel.hpp(206) : warning C6326: Potential comparison of a constant with another constant.
[...]\include\boost\math\special_functions\gamma.hpp(258) : warning C6326: Potential comparison of a constant with another constant.

These lines are indeed testing compile-time constants:

if((policies::digits<T, Policy>() <= 113) && (std::numeric_limits<T>::digits <= 113) && (std::numeric_limits<T>::radix == 2))

else if((z >= 3) && (z < 100) && (std::numeric_limits<T>::max_exponent >= 1024))

This warning is merely an annoyance, nothing is wrong with the code, so it should simply be silenced (e.g. with push-disable-pop).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions