Info-Performer: Strange compiler warning

New Message Reply Date view Thread view Subject view Author view

Jay Gischer (gischer++at++knex.engr.sgi.com)
Mon, 31 Aug 1998 10:15:54 -0700 (PDT)


Mario Veraart writes:
> Hi pfAll,
>
> I have stepped onto the n32 wagon and now I have a lot of warnings
> that are related to pfMatrix calls. I use the C-API of performer.
> The compiler for o32 does not complain, not does the C++ compiler.
>
> Can anybody explain why the compiler might generate the following
> warning
>
> All variables are of type pfMatrix
>
> "../draw.c", line 389: warning(1164): argument of type "float (*)[4]"
> is incompatible with parameter of type "const float (*)[4]"
> pfMultMat (m2, m1, dcs->pos_matrix);
> ^
>
> "../draw.c", line 389: warning(1164): argument of type "float (*)[4]"
> is incompatible with parameter of type "const float (*)[4]"
> pfMultMat (m2, m1, dcs->pos_matrix);
> ^
Interestingly enough, in C++ there would be no warning for this,
because "const" is fairly special as a type qualifier in C++.
Qualifying a formal parameter as "const" in C++ means that the routine
promises not to change the value.
Qualifying a formal parameter as "const" in C makes no such promise.
Rather, it means that the type of any actual parameter must be
qualified as "const"; "const" is handled no differently than, say,
"unsigned".

So when the C++ API of Performer is translated to a C API, this
warning appears, as if from nowhere. It could be argued that we
should remove all "const" qualifiers from formal parameters in the C
API, but this may have other undesirable effects.

------------------------------------------------------------------------
Jay L Gischer + "I see great things in baseball. It's our game.
Silicon Graphics + It will repair our losses and be a blessing to us."
(650) 390-4277 + -Walt Whitman
gischer++at++sgi.com +
                     + "A life has no meaning except in the impact it
                     + has on other lives"
                     + -Jackie Robinson


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 31 1998 - 10:16:00 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.