This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/30464] [regression] -Wconversion triggers warnings for deque<>::push_back()
- From: "gdr at cs dot tamu dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jan 2007 16:14:09 -0000
- Subject: [Bug libstdc++/30464] [regression] -Wconversion triggers warnings for deque<>::push_back()
- References: <bug-30464-231@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from gdr at cs dot tamu dot edu 2007-01-15 16:14 -------
Subject: Re: [regression] -Wconversion triggers warnings for
deque<>::push_back()
"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:
| (In reply to comment #5)
| > Sorry I read your reply later.
| >
| > So, that is it, isn't it? Wsystem-headers needs to be fixed since we don't
want
| > to emit warnings for system headers even if those warnings are correct.
|
| Well, first we don't know when, how, if, the pragma system_header will be
ever
| fixed. Then, assuming the warning is correct, certainly we want to adjust the
| library, that, in my opinion, makes certainly for good engineering (in fact,
we
| are generally relying on the effect of the pragma only in very few,
| last-resort, situations). Alternately, never emit the warning, of course.
I agree with Paolo that we use the system_header hack only as a last
resort -- in general.
However, there is a fundamental tension between unsigned<integer>
and <integer> use in the the C++ standard library and in libstdc++ in
particular. Many, among whom the designers of C++, consider
most uses of unsigned as indices or sizes as mistake (alas, the LWG
did not listen). I'm sure middle-end people could argue that they
can generate better codes if signed is used instead -- but that is a
different issue :-)
For libstdc++, we need to understand what gaurantees we give
for max_size() -- e.g. can we really handle elements that fill up the
whole range of size_type? If yes, then the warning is good in the
sense that it draws our attention to an untenable promise.
If not, then the warning isn't that useful -- well, in some sense it
is useful as it would force us to introduce more casts than we would
like. No wonder why people introduced ssize_t :-)
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30464