> Using the IRIX MIPSPro 7.2 C compiler I get this warning:
>
> % cc -n32 -c const.c
> "const.c", line 22: warning(1164): argument of type "float (*)[2]" is
> incompatible with parameter of type "const float (*)[2]"
> func2(v2);
> ^
> func1 takes a 1-D const array. The call to it works fine.
> func2 takes a 2-D const array. The call to it generates a warning.
>
> I don't understand this.
This is something that I consider a bug in the compiler, since the
code should be perfectly valid. I have seen similar bugs in the
Watcom C++ 10.6 compiler which went away in the 11.0 version.
> Anyway, in Mesa I try to be const-correct everywhere but hated seeing
> these warnings (and there are lots of them) so as a work-around I use the
> CONST macro.
Right, your solution is a good one because you are essentially
working around a bug in the compiler.
> I recommend that when you compile Mesa on your development systems
> that you enable the maximum compiler warnings. It helps ensure
> good code quality. Unfortunately, it sometimes causes little
> headaches like this.
Yep. With Watcom C++ 11.0a I do get a bunch of other warnings in the
Mesa code base that I have been planning on fixing one day...
Regards,
+---------------------------------------------------------------+
| SciTech Software - Building Truly Plug'n'Play Software! |
+---------------------------------------------------------------+
| Kendall Bennett | Email: [EMAIL PROTECTED] |
| Director of Engineering | Phone: (530) 894 8400 |
| SciTech Software, Inc. | Fax : (530) 894 9069 |
| 505 Wall Street | ftp : ftp.scitechsoft.com |
| Chico, CA 95928, USA | www : http://www.scitechsoft.com |
+---------------------------------------------------------------+