Re: [PATCH] gettext: more-consistent no-op macros
Bruno Haible via Gnulib discussion list <[email protected]>
| Newsgroups | gmane.comp.lib.gnulib.bugs |
|---|---|
| Message-ID | <9664459.Cn2kBfCCpG@cagnes> |
Paul Eggert wrote: > > As far as I can see, your patch will have the effect that > > gettext (some_function_that_returns_a_string ()) > > will produce a syntax error in C++ mode. > > > > Am I correct? > Sounds right. Would the attached (untested) patch address the C++ issue? Hmm. If the type is e.g. 'int', that would work. But if the type is 'const char *', this produces a syntax error: const char * (expr) > +#ifdef __cplusplus > +# define _LIBGETTEXT_FUNCAST(type, expr) (type (expr)) Why not #ifdef __cplusplus # define _LIBGETTEXT_FUNCAST(type, expr) static_cast<type> (expr) ? For the definition of static_cast, see [1]. Bruno [1] https://cppreference.com/cpp/language/static_cast