bug-gettext
[Top][All Lists]
Advanced

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

Re: [patch] libintl redefining sprintf creates issues


From: Bruno Haible
Subject: Re: [patch] libintl redefining sprintf creates issues
Date: Wed, 22 Dec 2021 13:04:34 +0100

Hi Marc,

> 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.

Yes, this would also have been my first recommendation.

> 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 …

I did not find a better approach. Defining symbols in yet another namespace
would not be the solution, because what this code attempts to do is really
to override the insufficient functions from the 'std' namespace.

Thank you for suggesting the approach that works.

https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=d452d71e630b59025f4107c0d1a5cbca8483c6b1

Bruno






reply via email to

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