tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: iconv(3) protype mismatch with POSIX



Kamil Rytarowski <n54%gmx.com@localhost> wrote:
> On 16.06.2016 05:28, David Holland wrote:
>> On Sun, May 29, 2016 at 03:54:29AM +0200, Kamil Rytarowski wrote:
>>  >
>>  > How about the Solaris 11 move? Leave "extern" option for those who rally
>>  > want it and SUS/POSIX for others.
>> 
>> "extern" option?
> 
> NAME
> 
> iconv - code conversion function
> 
> SYNOPSIS
> 
>    Default
> 
> #include <iconv.h>
> 
> extern size_t iconv(iconv_t cd, const char **restrict inbuf,
> size_t *restrict inbytesleft, char **restrict outbuf,
> size_t *restrict outbytesleft);
> 
> 
> SUSv3
> #include <iconv.h>
> 
> size_t iconv(iconv_t cd, char **restrict inbuf,
> size_t *restrict inbytesleft, char **restrict outbuf,
> size_t *restrict outbytesleft);
> 
> 
> https://illumos.org/man/3C/iconv

Uhm, color me stupid, but I don't see how "extern" makes any
difference here.

|      6.2.2  Linkages of identifiers
...
|      [#5] If the declaration of an identifier for a function  has
|      no   storage-class  specifier,  its  linkage  is  determined
|      exactly as  if  it  were  declared  with  the  storage-class
|      specifier  extern.

I suspect the line with extern was just pasted into synopsis from the
C header (dunno about Illumos, but at on Solaris the headers do use
"extern" for iconv declaration).

Solaris header declares iconv with const for xpg5 and w/out for xpg6.

-uwe



Home | Main Index | Thread Index | Old Index