Subject: Re: iconv(3) prototype (again)
To: None <tech-userlevel@netbsd.org>
From: T.SHIOZAKI <tshiozak@netbsd.org>
List: tech-userlevel
Date: 11/12/2004 03:20:43
From: christos@zoulas.com (Christos Zoulas)
Subject: Re: iconv(3) prototype
Date: Mon, 2 Aug 2004 15:40:01 GMT
Message-ID: <I1tsup.1IM@tac.nyc.ny.us>

> In article <20040802.230940.112628384.tshiozak@bsdclub.org>,
> T.SHIOZAKI <tshiozak@netbsd.org> wrote:
> >
> >> Just to be clear here (sorry no coffee). I meant that we should leave
> >> the prototype the way it is now:
> >> 
> >> size_t  iconv           __P((iconv_t, char ** __restrict,
> >>                              size_t * __restrict, char ** __restrict,
> >>                              size_t * __restrict));
> >> 
> >> add the reasoning in the bugs section, and ask Klaus to discuss changing
> >> it to const char **restrict in the POSIX committee meetings.
> >
> >Oops, I reverted them... we should not touch them any more before
> >the conclusion of the POSIX committee meetings, should we?
> 
> It seems to me that it is better to be compatible with the rest of the
> OS's out there. Soda-san posted a list of prototypes from a variety
> of OS's, and it seems to me that the other OS's are migrating from
> "const char **restrict" to "char **restrict" which seems backwards to
> me, but at least it is consistent (between the OS's). Since we have
> not had a formal release with iconv(3), so I think that we should
> follow what the majority of the OS's do. It is best right now to wait
> a couple of days before doing anything and get klaus' opinion.

By Klaus' information, this seems the issue already decided considerably
before on the committee(*), thus the change request is never accepted and
we need to change our iconv.h because to conform to POSIX specification
is the important one of our goals.

(*) cf.
http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=270
http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=271
http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=272
http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7404


I guess there are two approaches how to change it, either

  (1) just undo my back out, or
  (2) follow some commercial UNIX systems' examples (posted by Soda-san),
      such as:

#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED) && \
     _XOPEN_SOURCE_EXTENDED == 1) || \
    (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)
size_t   iconv(iconv_t, char **, size_t *, char **, size_t *);
#else
size_t   iconv(iconv_t, const char **, size_t *, char **, size_t *);
#endif


I vote to (2) because 2.0 branch (with "const char **" version of iconv(3))
is already frozen for the release and it seems too late to reflect it to 2.0,
thus it seems practically better for me to apply (2) towards 3.0.
(although I am a bit worried about whether such usage of the feature-test
macros is appropriate...)


Comments?


P.S. To: kleink
I am sorry that my response becomes very slow.

--
Takuya SHIOZAKI