Subject: Re: iconv(3) prototype
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 08/03/2004 18:13:13
In article <20040803085049.649d1a56.jklowden@schemamania.org>,
James K. Lowden <jklowden@schemamania.org> wrote:
>On Mon, 02 Aug 2004 13:08:05 +0200, Pavel Cahyna
><pavel.cahyna@st.ms.mff.cuni.cz> wrote:
>> On Tue, 27 Jul 2004 05:34:14 +0000, James K. Lowden wrote:
>> 
>> > On Mon, 26 Jul 2004, christos@zoulas.com (Christos Zoulas) wrote:
>> >> 
>> >> We have:
>> >> 
>> >> size_t
>> >> iconv(iconv_t, const char **restrict, size_t *restrict,
>> >>     char **restrict, size_t *restrict);
>> >> 
>> >> X/Open wants:
>> >> 
>> >> size_t
>> >> iconv(iconv_t, char **restrict, size_t *restrict,
>> >>     char **restrict, size_t *restrict);
>> >> 
>> >> What gives?
>> > 
>> > Not to start anything, but fwiw GNU defines theirs as const, too.  And
>> 
>> Really? Quoting from /usr/include/iconv.h :
>> 
>> extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
>>                      size_t *__restrict __inbytesleft,
>>                      char **__restrict __outbuf,
>>                      size_t *__restrict __outbytesleft);
>> (this is on Debian 3.0 - Woody, glibc-2.2.5-6).
>
>(What is the world use is it to declare formal parameters with two leading
>underscores?  Whose namespace are they protecting?)

Your namespace :-)

consider:

    #define outbuf (1 - 2)
    #include <iconv.h>

>I was going by what I'm using in pkgsrc:
>
>$ pkg_info libiconv |grep ^Info; grep ^extern /usr/pkg/include/iconv.h
>|grep inbytes
>
>Information for libiconv-1.9.1nb2:
>extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft,
>char* * outbuf, size_t *outbytesleft);
>
>However, it seems that due to C's type-conversion rules, there's simply no
>good way declare this function (in light of the standard).  It seems the
>consensus is to adhere to the standard, warts and all.  

We are all waiting for klaus's opinion :-)

christos