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

http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=33125


NetBSD iconv(3):

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

https://www5.opengroup.org/sophocles2/show_mail.tpl?&source=L&listname=austin-group-l&id=7404.
     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:

http://www.gnu.org/savannah-checkouts/gnu/libiconv/documentation/libiconv-1.14/.
     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:

http://git.savannah.gnu.org/cgit/libiconv.git/log/?qt=grep&q=iconv

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