X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Message-ID: <4B31A7E4.4040800@byu.net> Date: Tue, 22 Dec 2009 22:17:24 -0700 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: libiconv and iconv() prototype References: <4B318D91 DOT 6000602 AT cwilson DOT fastmail DOT fm> In-Reply-To: <4B318D91.6000602@cwilson.fastmail.fm> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Charles Wilson on 12/22/2009 8:25 PM: > Err...by changing the prototype, doesn't that change the ABI? > > -_EXFUN(iconv, (iconv_t, _CONST char **, size_t *, char **, size_t *)); > +_EXFUN(iconv, (iconv_t, char **, size_t *, char **, size_t *)); On the binary-compatibility perspective: I see no problem. const char** and char** are the same size, so older applications calling the newer function will still function as if nothing had changed. And as long as the implementation doesn't modify the argument (which libiconv does not, otherwise libiconv wouldn't have worked even when the const is present), all that is lost by omitting the const is an opportunity for a compiler optimization. You are correct that the POSIX prototype is not const-correct, since no sane implementation will ever modify the contents of inbuf. But it is specified without the const in POSIX iconv pre-dated const-correctness issues. On the compilation-compatibility perspective: yes, this is a backwards-incompatible change - anyone that passed a const char** to iconv will now have to add a cast to silence a compiler warning. On the other hand, such code was already non-portable because it conflicts with the POSIX prototype, so adding the cast to such code is good for portability anyways. > So, are you advocating a new cygiconv-3.dll? Or am I wrong, and this > change does NOT affect the ABI? I don't see any reason to bump to cygiconv-3.dll - it seems like keeping things at cygiconv-2.dll should still work. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9 AT byu DOT net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAksxp+QACgkQ84KuGfSFAYDDqgCgzLreqAg20Hx7ml0ZucjKdn9V 7hoAmQEae3eNyYxl2RC9OMKrt9TV5vvC =UsST -----END PGP SIGNATURE----- -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple