[Bug c/47143] warning about const multidimensional array as function parameter

rogi at linuxmail dot org gcc-bugzilla@gcc.gnu.org
Sat Jan 1 15:42:00 GMT 2011


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

Igor <rogi at linuxmail dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |

--- Comment #5 from Igor <rogi at linuxmail dot org> 2011-01-01 15:42:34 UTC ---
(In reply to comment #4)
> If you want to use const here only on the callee side then you will need to use
> casts.  I meant what I said: you are passing "pointer to array[4] of double",
> with no const in there, to a function expecting "pointer to array[4] of const
> double", and this is not a case permitted by C99 6.5.16.1#1.  C does not have a
> type "pointer to const array[4] of double".

Let me see if I understood.

const double a[4][4]

will become a "pointer to array of consts". So when i call my function passing
a "pointer to array", teh conversion fails since it's only allowed to apply teh
qualifier (const) to teh _pointer type_, which is an array, and not to it's
elements as teh function was expecting.

Correct me if I'm wrong again please and thanks for your patience.



More information about the Gcc-bugs mailing list