This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[website, changes] (was: Re: warning about const multidimensional array as function parameter)

Manuel LÃpez-IbÃÃez <>:

> On 14 October 2014 01:12, Martin Uecker <> wrote:
> > 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).
> You are probably right that it is safe. Unfortunately, C considers
> invalid cases that are safe and that are allowed by C++ (as mentioned
> in that C FAQ). I updated the FAQ with comments by Joseph Myers taken
> from and

Since my patch to change this has been accepted, could you please
update the FAQ again?

I would suggest to change the paragraph starting with 
"You are passing.." to:

"You are passing int (*)[3] to const int (*)[3], which is not correct
according to the C standard. You can disable the warning with
-Wno-incompatible-pointer-types. Starting with version 5, gcc
only warns about this when using '-pedantic'."

And then I would suggest to simply remove everything afterwards
because it refers to pointers-to-pointers and not pointers-to-arrays.

Also, I think the change could be mentioned here:

Suggested text:

"gcc will not warn about incompatible pointers types anymore when passing a 
pointer to an array as a pointer to a constant array or vice versa (except
when using '-pedantic'). Instead,it will emit a new warning only if the 
'const' qualifier is lost (see '-Wno-discarded-array-qualifiers')."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]