This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Don't understand cv-quals message



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
	



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]