On Thu, Jan 15, 2004 at 04:51:48PM +0300, Alexander V. Lukyanov wrote:
> > #include <string.h>
> > void func( const char **p ) { }
> > main()
> > {
> >     char *str = strdup("abc");
> >     func( &str );
> > }
> > 
> > test.cc:6: error: invalid conversion from `char**' to `const char**'
> 
> It's actually the reverse. I.e. iconv on your system is declared as
>       iconv(...,char **inbuf,...)
>       
> while correct prototype is
>       iconv(...,const char **inbuf,...)

Not inherently, since then you couldn't pass a pointer to a buffer that
*isn't* const, without another cast.  That's what I was showing.

Neither is correct--the desired constness can't be expressed in C++.

-- 
Glenn Maynard

Reply via email to