Skip to content

-Wbitwise-instead-of-logical compiler warnings #70

@nilason

Description

@nilason

Building rsgislib on Mac with AppleClang 15 produces some 70 cases of -Wbitwise-instead-of-logical compiler warnings.

Eg.:

if(gsl_matrix_get(inMatrix, 0, 1) == 0 & gsl_matrix_get(inMatrix, 1, 0) == 0)

/opt/local/var/macports/build/_Users_nilason_ports_gis_rsgislib/rsgislib/work/rsgislib-5.1.7/src/math/RSGISMatrices.cpp:259:6: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]
                if(gsl_matrix_get(inMatrix, 0, 1) == 0 & gsl_matrix_get(inMatrix, 1, 0) == 0)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                       &&
/opt/local/var/macports/build/_Users_nilason_ports_gis_rsgislib/rsgislib/work/rsgislib-5.1.7/src/math/RSGISMatrices.cpp:259:6: note: cast one or both operands to int to silence this warning

See complete build log: rsgislib_build.log

I figure it would be preferable to address theses warnings as to not cause unexpected behaviour.

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