Subject: Re: iconv(3) prototype
To: None <tech-userlevel@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 07/28/2004 03:30:24
> 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.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML email@example.com
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B