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 Sat, May 28, 2016 at 03:45:35PM +0200, Kamil Rytarowski wrote:
> [iconv const mess]
So it appears that given
size_t
iconv(iconv_t cd,
char **restrict src, size_t *restrict srcleft,
char **restrict dst, size_t *restrict dstleft);
size_t
__iconv_const(iconv_t cd,
const char **restrict src, size_t *restrict srcleft,
char **restrict dst, size_t *restrict dstleft);
one can do
#define iconv(cd, src, srcleft, dst, dstleft) \
_Generic(src, const char **: __iconv_const, default: iconv) \
(cd, src, srcleft, dst, dstleft)
and at least with the gcc5 in current it seems to match as intended.
Plus if anything unexpected comes up #undef iconv makes the magic go
away.
(Also, because implementing things as macros is not 100% benign it
should maybe be disabled by default in strict posix mode.)
Anyone want to check if it works in clang?
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index