std::stoi and std::to_string on MinGW

Jonathan Wakely jwakely@redhat.com
Mon Dec 22 16:41:00 GMT 2014


On 22/12/14 16:02 +0100, Kai Tietz wrote:
>2014-12-20 3:28 GMT+01:00 Jonathan Wakely <jwakely.gcc@gmail.com>:
>> People keep hitting the problem that std::stoi and std::to_string are
>> not defined when using MinGW, because of the fix for
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37522
>>
>> If the problem is only with vswprintf then couldn't we enable
>> everything except std::to_wstring?
>>
>> That would solve the problem for most people, as std::to_string and
>> all the std::sto* functions would be defined, we'd only be missing
>> std::to_wstring which I never see anyone trying to use anyway.
>
>So patch is ok.  AFAICS it affects just MinGW.org based build of libstdc++, as
>
>_GLIBCXX_HAVE_BROKEN_VSWPRINTF is just defined in this case.  For
>mingw targets using mingw-w64 based build this change has no affect
>due it provides none-broken w-scanf/printf C99 API,

Yes, this only affects mingw.org not mingw-w64

>Patch is ok.
>
>Thanks,
>Kai
>
>PS: By mingw-w64 users the wide-character API is actually used.

Thanks, Kai. Here's the full patch, which enables std::stoi etc.
(everything except std::to_wstring) for MinGW.org

Tested powerpc64-linux, committed to trunk.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 7686 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20141222/64306ba3/attachment.bin>


More information about the Libstdc++ mailing list