Subject: Re: iconv(3) prototype
To: None <christos@zoulas.com>
From: T.SHIOZAKI <tshiozak@netbsd.org>
List: tech-userlevel
Date: 07/28/2004 15:54:38
From: christos@zoulas.com (Christos Zoulas)
Subject: Re: iconv(3) prototype
Date: Tue, 27 Jul 2004 23:31:41 -0400
Message-ID: <20040728033141.0108C2AC78@beowulf.gw.com>
> On Jul 27, 10:17pm, atatat@atatdot.net (Andrew Brown) wrote:
> -- Subject: Re: iconv(3) prototype
>
> | other than the periodic pain inflicted on the callee by const
> | (grr...strtol(3)), what kind of program would have trouble with our
> | iconv() but not the x/open one?
>
> You cannot write portable code that does not produce warnings.
Quite so.
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.
If the code is written so as not to get warnings with our iconv(),
it will get warnings with X/Open iconv(). v.v.
Really, here is the sole portable way: ((size_t (*)())iconv)(cd, &src, ....);
This is not the essence of this problem though.
So, I will change it, ok?
--
Takuya SHIOZAKI