This is similar to (but different from) this question.
Here is some simple test code to illustrate some weirdness I have discovered with Sun CC:
//--
The const
is void func1(const int)
has no affect whatsoever on the function, since the int is passed by value --- a copy of the int is made, and that copy lives only as long as the function call. Whether or not you change that copy has no bearing on anything.
You are probably confused by the fact that in void func2(const char*)
the const
is significant. But you have to recognized that is different from void func3(char* const)
. In the former, it's the character pointed to that cannot change; in the latter, it's the pointer that is (irrelevantly) 'const'