public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-6286] libcody: to_string is not always available [PR 98412] Date: Mon, 21 Dec 2020 13:42:23 +0000 (GMT) [thread overview] Message-ID: <20201221134223.BB0D13857815@sourceware.org> (raw) https://gcc.gnu.org/g:119d7478d1a7d59a0fa5a02690b2555ac2c3ed89 commit r11-6286-g119d7478d1a7d59a0fa5a02690b2555ac2c3ed89 Author: Nathan Sidwell <nathan@acm.org> Date: Mon Dec 21 05:38:34 2020 -0800 libcody: to_string is not always available [PR 98412] to_string is not always available, so don't use it. libcody/ * buffer.cc (MessageBuffer::AppendInteger): Workaround to_string's non-ubiquity. Diff: --- libcody/buffer.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libcody/buffer.cc b/libcody/buffer.cc index 3256c37399b..85c066fef71 100644 --- a/libcody/buffer.cc +++ b/libcody/buffer.cc @@ -146,7 +146,13 @@ void MessageBuffer::Append (char c) void MessageBuffer::AppendInteger (unsigned u) { - std::string v (std::to_string (u)); + // Sigh, even though std::to_string is C++11, we support building on + // gcc 4.8, which is a C++11 compiler lacking std::to_string. so + // have something horrible. + std::string v (20, 0); + size_t len = snprintf (const_cast<char *> (v.data ()), v.size (), "%u", u); + v.erase (len); + AppendWord (v); }
reply other threads:[~2020-12-21 13:42 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201221134223.BB0D13857815@sourceware.org \ --to=nathan@gcc.gnu.org \ --cc=gcc-cvs@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).