From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15631 invoked by alias); 19 Jul 2005 06:22:14 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 15617 invoked by uid 22791); 19 Jul 2005 06:22:11 -0000 Received: from yosemite.airs.com (HELO yosemite.airs.com) (205.217.158.180) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Tue, 19 Jul 2005 06:22:11 +0000 Received: (qmail 17932 invoked by uid 10); 19 Jul 2005 06:22:09 -0000 Received: (qmail 25881 invoked by uid 500); 19 Jul 2005 06:22:01 -0000 Mail-Followup-To: gcc-help@gcc.gnu.org, desrt@desrt.ca To: Ryan Lortie Cc: gcc-help@gcc.gnu.org Subject: Re: Questions about const. References: <1121481285.1978.0.camel@moonpix.desrt.ca> From: Ian Lance Taylor Date: Tue, 19 Jul 2005 06:22:00 -0000 In-Reply-To: <1121481285.1978.0.camel@moonpix.desrt.ca> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-07/txt/msg00173.txt.bz2 Ryan Lortie writes: > GCC generates some warnings when doing type conversions in places that I > don't believe the warnings are required. It'd be be cool if someone > could explain it to me. I have an example program here: > > http://manic.desrt.ca/const.c > > I'm guessing that, by the C standard, arrays that contain items of > different types are always considered incompatible and since 'char *' > and 'const char *' are different types then 'const char **' and 'char > **' are incompatible pointers. This just doesn't seem very useful when > one of the base types is always safe to automatically promote to the > other (in this case, char * -> const char *) and there is no chance that > an unnoticed conversion could ever occur in the other direction without > generating another warning/error. As you say, this is from the C standard. gcc tries to follow the standard. Ian