public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25880]  New: suggestion: a special warning for discarding the ``const'' qualifier
@ 2006-01-20 15:59 roland dot illig at gmx dot de
  2006-01-20 16:00 ` [Bug c/25880] " roland dot illig at gmx dot de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: roland dot illig at gmx dot de @ 2006-01-20 15:59 UTC (permalink / raw)
  To: gcc-bugs

The current gcc warning for discarded qualifiers cannot be easily understood by
beginners:

$ cat const.c
int main(void)
{
        const char *pcc;
        char *pc;

        pcc = "hello, world";
        pc = pcc;
        return 0;
}

$ gcc -Wall -W const.c 
const.c: In function `main':
const.c:7: warning: assignment discards qualifiers from pointer target type

This warning doesn't give any hint to a programmer not familiar with the ISO
standard's wording. Therefore I suggest to make a special case warning if the
only qualifier that's discarded is ``const''. It would then show up like this:

$ ~/pkg/gcc3/bin/gcc -Wall -W const.c 
const.c: In function `main':
const.c:7: warning: assignment discards ``const'' qualifier from pointer target
type


-- 
           Summary: suggestion: a special warning for discarding the
                    ``const'' qualifier
           Product: gcc
           Version: 3.3.5
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: roland dot illig at gmx dot de
 GCC build triplet: *-*-*
  GCC host triplet: *-*-*
GCC target triplet: *-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25880


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-09-08 23:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-20 15:59 [Bug c/25880] New: suggestion: a special warning for discarding the ``const'' qualifier roland dot illig at gmx dot de
2006-01-20 16:00 ` [Bug c/25880] " roland dot illig at gmx dot de
2006-01-20 16:04 ` pinskia at gcc dot gnu dot org
2010-06-04 15:16 ` [Bug c/25880] improve message of warning for discarding qualifiers manu at gcc dot gnu dot org
2010-06-04 15:22 ` manu at gcc dot gnu dot org
2010-09-08 23:06 ` rmansfield at qnx dot com
2010-09-08 23:34 ` manu at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).