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

Jonathan Wakely jwakely.gcc@gmail.com
Sat May 15 08:23:32 GMT 2021


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.


More information about the Libstdc++ mailing list