Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nilason opened this issue Jul 30, 2024 · 1 comment
Open

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

nilason opened this issue Jul 30, 2024 · 1 comment

Comments

@nilason
Copy link

nilason commented Jul 30, 2024

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.

@petebunting
Copy link
Member

Thanks for this. I'll put it on the list to take a look into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants