W dniu 14 stycznia 2010 11:13 użytkownik Jon Cruz <jon@...18...> napisał:
Also... can you pinpoint exactly what situation causes the warnings you mentioned?
I've not noticed any showing up.
The warnings are triggered when using boost::optional::operator*() on GCC 4.4. There is no way of avoiding the warnings, because they are incorrect - there should be no warning in this case. The aliasing rules are not violated by boost::optional. In other words, it's a bug in GCC. See the links I mentioned.
You are not seeing the warnings because you either have a different (earlier) version of GCC, or you have already reconfigured with my changes. Check the configure output for "Checking for overzealous strict aliasing warnings", it should be right after "Checking for boost/concept_check.hpp". If it's "no", then strict aliasing warnings are enabled for you.
It's nearly impossible to inadvertently cause an aliasing violation when using sane C++. You have to actively write very dubious code like "float x = -1.0; (*(int*) &x) &= 0x7fffffff;" to cause them. I think it should be relatively safe, and the real warnings won't be drowned out by the boost::optional spam.
Regards, Krzysztof