Is it possible not to use snprintf or any other stdio functionalities to throw std::logic_error in standard library containers?

Jonathan Wakely jwakely@redhat.com
Thu May 20 19:20:40 GMT 2021


On 15/05/21 09:23 +0100, Jonathan Wakely via Libstdc++ wrote:
>On Sat, 15 May 2021, 04:12 unlvsur unlvsur via Libstdc++, <
>libstdc++@gcc.gnu.org> wrote:
>
>> The issue is that this will silently introduce dependency to stdio. On
>> MinGW-w64 for example, any snprintf function call will bloat binary size
>> for 70kb, that is even we shared linking with both msvcrt and libstdc++.
>>
>> I frequently see a random bloat because of that.
>>
>> By the way, it also hurts optimizations since compilers cannot merge them
>> together.
>>
>> Better just throw an exception with “vector<T> out of bounds” instead of
>> formatting subscriptor.
>>
>
>
>I can make that depend on the _GLIBCXX_VERBOSE macro.

Where is the dependency on stdio coming from though? Formatting the
exception string doesn't use stdio.



More information about the Libstdc++ mailing list