This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -Wconversion versus libstdc++


Paolo Carlini wrote:
Martin Sebor wrote:

FYI: HP aCC warns for some but not all of these types of lossy
initializations. For example, a double to int conversion emits
a warning but ptrdiff_t to size_t or other signed to unsigned
conversions do not, probably because they're so common. I find
this behavior useful.


Thanks Martin for the data point: I understand that this behavior is typical of the compilers based on the EDG front-end?

aCC 3.70 is not based on the EDG front end (aCC 6 is and starting with 6.05 it gives the same warning). The EDG 3.80 demo doesn't give a warning for this case, so it looks like the warning might be an HP feature.


Anyway, note that our -Wconversion is not part of -Wall, not even -Wextra: are you maintaining that probably the bits having to do with float <-> integer should also be part of -Wall or at least -Wextra?

We use both -Wall and -W so we don't really have a preference for which warnings are controlled by which of the two options but since these initializations can (unexpectedly) yield a different value than the initializing expression I think it deserves a warning even if it's not explicitly requested. That way users will get the benefit of the new feature after upgrading without having to read the new manual or tweaking their makefiles. (I think it might even be safe to assume that most users who use -Wall actually expect to see all warnings, or at least wouldn't be surprised if a new warning were added).

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]