From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20471 invoked by alias); 20 Jan 2006 15:59:10 -0000 Received: (qmail 20460 invoked by uid 48); 20 Jan 2006 15:59:08 -0000 Date: Fri, 20 Jan 2006 15:59:00 -0000 Subject: [Bug c/25880] New: suggestion: a special warning for discarding the ``const'' qualifier X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "roland dot illig at gmx dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-01/txt/msg02081.txt.bz2 List-Id: 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