From: Jonathan Wakely <jwakely@redhat.com>
To: unlvsur unlvsur <unlvsur@live.com>
Cc: unlvsur unlvsur via Libstdc++ <libstdc++@gcc.gnu.org>
Subject: Re: Is it possible not to use snprintf or any other stdio functionalities to throw std::logic_error in standard library containers?
Date: Thu, 20 May 2021 20:52:32 +0100 [thread overview]
Message-ID: <YKa+AOIOb7b7iD1r@redhat.com> (raw)
In-Reply-To: <DM6PR05MB469776570EE332423E1BE7F9D62A9@DM6PR05MB4697.namprd05.prod.outlook.com>
On 20/05/21 19:47 +0000, unlvsur unlvsur wrote:
>// I have disabled libstdcxx verbose
>
>#include<fast_io.h>
>
>int main(int argc,char** argv)
>{
> std::string_view str(*argv);
> puts(str.substr(4).data());
>}
>
>g++ -o b b.cc -Ofast -std=c++20 -s -flto -march=native -I../fast_io/include -static-libstdc++
>
>binary size 86kb
>
>
>#include<fast_io.h>
>
>int main(int argc,char** argv)
>{
> std::string_view str(*argv);
> if(str.size()<4)
> __builtin_trap();
> puts(std::string_view(str.data()+4,str.size()).data());
>}
>
>g++ -o c c.cc -Ofast -std=c++20 -s -flto -march=native -I../fast_io/include -static-libstdc++
>
>binary size 15kb
OK, but it still doesn't use stdio.
__throw_out_of_range_fmt is defined in src/c++11/functexcept.cc which
uses __snprintf_lite defined in src/c++11/snprintf_lite.cc which
doesn't use stdio.
prev parent reply other threads:[~2021-05-20 19:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 2:25 unlvsur unlvsur
2021-05-15 8:23 ` Jonathan Wakely
2021-05-20 19:20 ` Jonathan Wakely
[not found] ` <DM6PR05MB4697628C7E6769B8FCDA1D6ED62A9@DM6PR05MB4697.namprd05.prod.outlook.com>
2021-05-20 19:35 ` Jonathan Wakely
2021-05-20 19:47 ` unlvsur unlvsur
2021-05-20 19:50 ` unlvsur unlvsur
2021-05-20 20:00 ` Jonathan Wakely
2021-05-20 19:52 ` Jonathan Wakely [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YKa+AOIOb7b7iD1r@redhat.com \
--to=jwakely@redhat.com \
--cc=libstdc++@gcc.gnu.org \
--cc=unlvsur@live.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).