On 12/16/2016 06:04 PM, Jakub Jelinek wrote: > On Fri, Dec 16, 2016 at 06:55:12PM +0100, Janus Weil wrote: >> To get to more specific questions ... >> >>> Basically the only STL construct used in the Fortran FE right now >>> seems to be std::swap, and a single instance of std::map in >>> trans-common.c. >> >> I see that fortran/trans-common.c has: >> >> #define INCLUDE_MAP >> >> and apparently there is also a INCLUDE_STRING macro. I guess if I want >> to use std::string I don't #include <string>, but #define >> INCLUDE_STRING, right? Why are those macros needed, exactly? > > They are needed because system.h poisons lots of things, including malloc > etc. So including system headers after system.h is problematic.
IMO, GCC's poison (or a variant) should ignore system headers. There's nothing one can do with those. It's _uses_ in one's code that generally one wants to prevent with the poisoning. > > That said, using std::string for what you talk in the PR would make it > impossible to translate it, if you build a sentence as: > ss << "Argument " << something () << " and '" << something_else () << "'"; > then our framework can't deal with that, translating portions of a sentence > is not going to be useful for many languages. > Using *printf or similar formatting strings allows the translator to see > the whole sentence with arguments, and e.g. when needed can swap > some arguments using %4$s syntax etc. The problem is not std::string here, but the stream operators. And I agree. GDB has a string_printf function that prints into a std::string, for example. Like: std::string hello = string_printf ("%s", "hello world"); That's a function that many C++ projects reinvent.