------- Comment #4 from tom at atoptech dot com 2009-03-10 17:40 ------- Manuel,
You miss understood what I meant by "old behavior was just fine". I was saying that the previous behavior of "gcc" worked fine and I was NOT referring specifically to the "-Wconversion" option. The previous version of "gcc" warned when implicit narrowing of doubles to integral values, such as double n = 0.0000000005; int d = n; when using the "-Wall" option. The behavior of "gcc" has changed. Moving all the conversion warnings to fall under "-Wconversion" may make semantic sense, but it alters the behavior of "gcc". We can fault ourselves for missing this change in the documentation, but there a level of expectation that the fundamental behavior of the compiler is consistent from release-to-release. And when fundamental behavior of "gcc" changes, ample notice should be given. People need to change Makefiles, alter code (if possible), etc... With regard to "-Wtraditional-conversion", it does not work when compiling "C++" code. > Do you think this would be an acceptable solution? (I don't know if this works > now in GCC 4.4) Absolutely not. It's not a portable solution. There is nothing in the "C++" standard (that I'm aware of) that suggests that "anding" an integral value with a "constant" value results in a truncated integral value. It's a bad hack. As you say, its is unfortunate that "C" and "C++" do not have a bit-field "cast-operators". But that is the reality. There is a lot of code written using "bit-fields". Look at "gcc" itself. Until the "C" or "C++" language contains a "type-safe" construct, such as a cast-operator, "gcc" should not issue a warning by default. If you have ideas on how to solve this, please submit them to the "C" or "C++" standards group. The "gcc" 4.3 stream is not safe (for us) to use as is. We need the compiler to issue warnings when implicit narrowing occurs (expect in the case of a bit-field). As is, we get thousands of warnings from our code when using "-Wconversion". Consequently, we are forced disable "-Wconversion" to suppress the bit-field warnings at the risk of missing other narrowing warnings. And this is not acceptable to us. We've already moved back to the 4.2 "gcc". Best Regards, Tom Geocaris -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39170