gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > passing arg X of 'Y' discards qualifiers from...

#172256 - Kensai - Wed Jan 27, 2010 8:13 pm

... pointer target type

This compiler warning occurs if I try to use a pointer on a constant array as an argument. Can it be avoided somehow?

#172257 - Dwedit - Wed Jan 27, 2010 8:15 pm

Yeah, declare your function to take in const arrays.
Declaring a function to NOT take in const arrays is like saying "Yeah, this function will totally modify everything in the array". And the compiler will scream about that because you can't be modifying const stuff.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."