public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/78710] suggest better exception text for stoi, stol, ...
       [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
  2023-07-13 17:10 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-03-08 10:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78710

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-03-08
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |libstdc++

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/78710] suggest better exception text for stoi, stol, ...
       [not found] <bug-78710-4@http.gcc.gnu.org/bugzilla/>
  2021-03-08 10:16 ` [Bug libstdc++/78710] suggest better exception text for stoi, stol, redi at gcc dot gnu.org
@ 2021-03-08 11:56 ` redi at gcc dot gnu.org
  2023-07-13 17:10 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-03-08 11:56 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/78710] suggest better exception text for stoi, stol, ...
       [not found] <bug-78710-4@http.gcc.gnu.org/bugzilla/>
  2021-03-08 10:16 ` [Bug libstdc++/78710] suggest better exception text for stoi, stol, redi at gcc dot gnu.org
  2021-03-08 11:56 ` redi at gcc dot gnu.org
@ 2023-07-13 17:10 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-07-13 17:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78710

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-13 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-78710-4@http.gcc.gnu.org/bugzilla/>
2021-03-08 10:16 ` [Bug libstdc++/78710] suggest better exception text for stoi, stol, redi at gcc dot gnu.org
2021-03-08 11:56 ` redi at gcc dot gnu.org
2023-07-13 17:10 ` redi at gcc dot gnu.org

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).