bug-gettext
[Top][All Lists]
Advanced

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

[patch] libintl redefining sprintf creates issues


From: Marc Jeanmougin
Subject: [patch] libintl redefining sprintf creates issues
Date: Mon, 20 Dec 2021 16:59:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2

Hi!
I have an issue with the redefinitions of sprintf in libintl.h on mingw64 because the "#define sprintf libintl_sprintf" does not take into account that sprintf is available in std, so when boost headers start referring to std::sprintf the compiler complains that std::libintl_sprintf does not exist...

When I reached out to boost* they recommended to include boost headers "before" whatever includes libintl (in my case, glib/gi18n) but that is not very maintainable.

My next best option is to "fix" gettext, I found a hack (patch attached) by just adding a "namespace std { using ::libintl_sprintf; }" within a #ifdef __cplusplus__ block just after the #define, which does work, but since it is in theory UB**, you may have other ideas which will probably have to get rid of the #define …

Thanks!

--
Marc

* https://github.com/boostorg/assert/issues/24
** https://en.cppreference.com/w/cpp/language/extending_std

Attachment: 0001-Make-libintl-printf-functions-available-in-std-names.patch
Description: Text Data

Attachment: OpenPGP_0x5FCB204EF882B07A.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]