Subject: Re: iconv(3) prototype
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: None <cube@cubidou.net>
List: tech-userlevel
Date: 07/28/2004 09:34:57
On Wed, Jul 28, 2004 at 03:30:24AM -0400, der Mouse wrote:
> > The point of this problem is that the 2nd argument of iconv() is "a
> > pointer of a pointer". "char *" can be converted to "const char *"
> > explicitly, but "char **" cannot be converted to "const char **"
> > without warning.
>
> Well, without a cast, yes. I've never understood why char ** is
> incompatible with const char **....
>
> > Really, here is the sole portable way: ((size_t (*)())iconv)(cd, &src, ....);
>
> That's not all that portable, as it's calling a defined-as-prototyped
> function with a non-prototyped calling sequence; I don't think that's
> guaranteed to work. I'd say a more portable way to write code is with
> an explicit cast to (const char **) on the relevant argument.
But won't that produce a warning with our prototype?
Quentin Garnier.