This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12963] Wrong and misleading warning encourages writing non-portable code
- From: "jsm at polyomino dot org dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Sep 2004 23:08:31 -0000
- Subject: [Bug c++/12963] Wrong and misleading warning encourages writing non-portable code
- References: <20031108134219.12963.bagnara@cs.unipr.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jsm at polyomino dot org dot uk 2004-09-20 23:08 -------
Subject: Re: Wrong and misleading warning encourages writing
non-portable code
On Mon, 20 Sep 2004, giovannibajo at libero dot it wrote:
> Besides the consistency issue, which is a bug and should be reported elsewhere,
> I do not understand how this encourage writing non-portable code. On the
> contrary, it does *help* it.
A program has some data in a type such as char or uid_t which needs to be
stored in an externally defined structure, or transmitted by an externally
defined protocol. This external definition imposes a limit of (say 255)
on the value held in (say) unsigned char. A portable program checks that
the data is within the defined range before storing or transmitting it.
Some checks are redundant on a particular system, so receive these
warnings; if the warnings are to be silenced, that means removing checks
that are not dead code on other systems. I have encountered such problems
(warnings that cannot effectively be silenced) in real code, both with
system typedefs such as uid_t and user typedefs that may be configured to
be a type such as unsigned char or a wider type. My comment #8 still
applies: this does not even belong in -Wall.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12963