This is the mail archive of the
mailing list for the GCC project.
Re: warning about const multidimensional array as function parameter
- From: Martin Uecker <uecker at eecs dot berkeley dot edu>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>, gcc Mailing List <gcc at gcc dot gnu dot org>
- Date: Mon, 13 Oct 2014 16:12:26 -0700
- Subject: Re: warning about const multidimensional array as function parameter
- Authentication-results: sourceware.org; auth=none
- References: <CAESRpQC0=QFaDNrs2YmzcRHfDw_iiKKwJCLQT=p0Un_ph_=+=A at mail dot gmail dot com> <20141013160138 dot 3a3b0c06 at lemur> <CAH6eHdSF5tVhfsFq8OV_ysYfovh17hJSVLQeLvEWsnAn8N+xgQ at mail dot gmail dot com>
Am Tue, 14 Oct 2014 00:05:47 +0100
Jonathan Wakely <email@example.com>:
> On 14 October 2014 00:01, Martin Uecker wrote:
> > Manuel LÃpez-IbÃÃez <firstname.lastname@example.org>:
> > Thank you for your quick response.
> >> > Could we have an option to turn these warnings off?
> >> This will be controlled by a new option in GCC 5.0.
> >> For the details and the answer to your other questions, see
> >> https://gcc.gnu.org/wiki/FAQ#constmismatch
> > The option '-Wincompatible-pointer-types' would turn of all
> > warnings about incompatible pointers. I want a specific options
> > to turn of the completely pointless warning about converting
> > to pointers to constant arrays, which warns about something
> > which is actually completely safe.
> It isn't complete safe. http://c-faq.com/ansi/constmismatch.html
A pointer to an array is not the same thing as a pointer to a pointer.
Converting a pointer to an array to a pointer to a constant array
is safe. Converting a pointer to a pointer to a pointer to a pointer
to a constant is not (as the CFAQ points out).