tech-userlevel archive

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

Re: iconv(3) protype mismatch with POSIX



On 16.06.2016 05:28, David Holland wrote:
> On Sun, May 29, 2016 at 03:54:29AM +0200, Kamil Rytarowski wrote:
>  > This is an interesting exercise to use C11.. however:
>  > 1. Not all ports moved to gcc 4.9+,
>  > 2. pcc doesn't support it,
>  > 3. it won't work as a valid and acceptable C++ code.
>  > 4. Many software expects system headers to be C89, GNU89 etc, and
>  > doesn't request C11.
> 
> None of that matters, it just needs to be wrapped in suitable ifdefs.
> 

All of them matters to me and C11 in a public-header is no-go.

Also if we allow the POSIX version in our headers then the non-complaint
one is pointless, as no modern, popular and general-purpose OS is in
"our" camp with "improved" API.

I keep paying this debt all over again in new software that never
assumes pre-2007 or so version of iconv(3) in Linux. Our patches for it
in pkgsrc are pending for years (like in qt4) nobody bothered to even
upstream "better" iconv(3).

>  > 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

These calls with and without const should be ABI compatible.


Home | Main Index | Thread Index | Old Index