tech-userlevel archive

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

iconv(3) protype mismatch with POSIX

This was already noted in 2006

NetBSD iconv(3):

iconv(iconv_t cd, const char ** restrict src, size_t * restrict srcleft,
char ** restrict dst, size_t * restrict dstleft);

It says that:
     Historically, the definition of iconv has not been consistent across
     operating systems.  This is due to an unfortunate historical mistake,
     documented in this e-mail:
     The standards page for the header file <iconv.h> defined the second
     argument of iconv() as char **, but the standards page for the iconv()
     implementation defined it as const char **.  The standards committee
     later chose to change the function definition to follow the header file
     definition (without const), even though the version with const is
     arguably more correct.  NetBSD has always used the const form.  It was
     decided to reject the committee's regression and become (technically)
     incompatible.  GNU libiconv has taken the same route:
     Most third party software affected by this issue already handles it
     during configuration.

It's no longer true for gnu libiconv. They gave up and removed "const"
in 2009:

Perhaps we are the only ones left there and new software (like .NET or
Qt5) no longer handles the "const" variation. Can we legalize the POSIX
mistake from the past and align to the rest of world?

Home | Main Index | Thread Index | Old Index