This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/47143] warning about const multidimensional array as function parameter
- From: "rogi at linuxmail dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 1 Jan 2011 15:42:35 +0000
- Subject: [Bug c/47143] warning about const multidimensional array as function parameter
- Auto-submitted: auto-generated
- References: <bug-47143-4@http.gcc.gnu.org/bugzilla/>
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.