This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Don't understand cv-quals message
- To: egcs at cygnus dot com
- Subject: Don't understand cv-quals message
- From: "Han Holl" <jeholl at euronet dot nl>
- Date: Sun, 1 Feb 1998 13:27:01 +0100 (MET)
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