This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libiconv and iconv() prototype

Hash: SHA1

According to Charles Wilson on 12/22/2009 8:25 PM:
> 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

> 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   
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]