I guess the phrasing is a bit weak, "some users" obviously has to refer to a significant proportion of users, "easy to avoid" cannot have too many drawbacks (in particular, generated code should be of equivalent quality), etc.

-Wclass-memaccess fits the "easy to avoid" quite well, since a simple cast disables it. -Wmaybe-uninitialized is much worse: it produces many false positives, that change with every release and are super hard to avoid. And even in the "easy to avoid" category where we don't want to litter the code with casts to quiet the warnings, I find -Wsign-compare way worse in practice than -Wclass-memaccess.

I personally get annoyed with the amount of hand-holding compilers seem to need now in order to do what I ask them to do - and this isn't leveled at GCC, but also clang and MSVC. Some of it makes sense in order to check the programmer meant to make that conversion, but you end up with a hell of a lot of static/other casts, and it's not great for readability. As a side-note, the workaround for memset/cpy/move as mentioned isn't visible in the warning, which I think it probably should be, rather than just the GCC documentation. Still, as you all have mentioned, the workaround is pretty straight-forward in this case, so that's good.
M@

Reply via email to