sinandredemption/M42

Compilation errors with gcc

Closed this issue · 2 comments

I get two compilation errors when compiling with gcc (compiler flags -Werror -Wall -Wextra -std=c++20).

 M42/m42.h:124:17: error: ‘bit_width’ is not a member of ‘std’
  124 |     return std::bit_width(b) - 1;

It can be fixed by adding #include <bit> at the beginning of m42.h

M42/m42.cpp:51:18: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
   51 |     } while (occ = next_subset(Masks[sq], occ));

It can be fixed by adding extra parentheses:

} while ((occ = next_subset(Masks[sq], occ)));

Also please convert the line endings to lf instead of crlf (https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings).

Thank you for releasing M42.

Hello @anagorko

Pardon me for not extensively testing M42 with gcc.

It seems like the fixes you proposed are simple, correct, and safe. As such, if it's not too much trouble, I would request you to submit a PR and I will merge it right away.

i'm not into C++ programming, now and then i only compile C++ sources (on Linux), but once i read (*) :

gcc is for C and will not give you access to the C++ standard library

*) see https://stackoverflow.com/questions/28236870/error-undefined-reference-to-stdcout

so, compiling .cpp files with gcc is not adviced !?