public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/78710] suggest better exception text for stoi, stol, ... Date: Mon, 08 Mar 2021 11:56:56 +0000 [thread overview] Message-ID: <bug-78710-4-1qd5tmCTQS@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-78710-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78710 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Nicolai Josuttis from comment #0) > stoi("hello") currently throws an exception where what() only outputs "stoi" > (nothing else). The type of the exception is significant too. It can either throw std::invalid_argument("stoi") or std::out_of_range("stoi"). > Some component (either __stoa() or __throw_invalid_argument()) > should extend the message at least a bit. > E.g. __stoa() might call > std::__throw_invalid_argument("invalid argument for " + __name) This makes it (very slightly) more likely to throw std::bad_alloc than to throw what we actually want to throw. It's probably a reasonable trade-off to get a better what() message though.
next prev parent reply other threads:[~2021-03-08 11:56 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-78710-4@http.gcc.gnu.org/bugzilla/> 2021-03-08 10:16 ` redi at gcc dot gnu.org 2021-03-08 11:56 ` redi at gcc dot gnu.org [this message] 2023-07-13 17:10 ` redi at gcc dot gnu.org
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=bug-78710-4-1qd5tmCTQS@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).