public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* What should a std::error_code pretty printer show?
@ 2021-08-16 11:55 Jonathan Wakely
  2021-08-16 12:11 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2021-08-16 11:55 UTC (permalink / raw)
  To: libstdc++

I'm adding a GDB printer for std::error_code.What I have now prints
the category name as a quoted string, followed by the error value:

{"system": 0}
{"system": 1234}

If the category is std::generic_category() then it also shows the
strerror description:

{"generic": 13 "Permission denied"}

But I'd also like it to show the errno macro, but I'm not sure what's
the best way to show it.

Does this seem OK?

{"generic": 13 EACCES "Permission denied"}

I think that's a bit too verbose.

Would {"generic": EACCES} be better? You can always use ec.value() to
get the numeric value, and strerror to get the description if you want
those.

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

end of thread, other threads:[~2021-08-16 19:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 11:55 What should a std::error_code pretty printer show? Jonathan Wakely
2021-08-16 12:11 ` Jonathan Wakely
2021-08-16 16:51   ` Jonathan Wakely
2021-08-16 19:30     ` Jonathan Wakely

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