Don't understand cv-quals message
Han Holl
jeholl@euronet.nl
Sun Feb 1 04:28:00 GMT 1998
Hello,
If I compile the following program (with egcs-1.0.1) :
#include <iostream.h>
void f(const char** s)
{
cout << *s << endl;
}
main()
{
char *cs = "abcd";
f(&cs);
}
with:
g++ --pedantic
I get the following warning:
t1.C: In function `int main()':
t1.C:11: warning: passing `char **' as argument 1 of `f(const char **)' \
adds cv-quals without intervening `const'
What does this mean, and can I do anything to make it go away? (I.e.,
can I make this code even more 'pedanticly' correct ? I fail to see how).
As I understand this, what f() does is promise not to poke around in the
characters, and I should be able to pass a non-const char ** to it.
(This works of course with passing char * to a const char * function).
Thanks in advance for any explanation,
Han Holl
More information about the Gcc
mailing list