public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dave.anglin at bell dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/110653] Support std::stoi etc. without C99 APIs Date: Thu, 13 Jul 2023 15:14:02 +0000 [thread overview] Message-ID: <bug-110653-4-lhnVy62SwN@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110653-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110653 --- Comment #3 from dave.anglin at bell dot net --- On 2023-07-13 9:46 a.m., redi at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110653 > > --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- > Created attachment 55534 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55534&action=edit > libstdc++: std::stoi etc. do not need C99 <stdlib.h> support > > Dave, does this patch work for hppa64-hp-hpux11.11 ? Yes. > > It should allow you to compile + run the code below: > > #include <string> > int main() > { > std::string z = "0"; > return std::stoi(z) + std::stol(z) + std::stoul(z) + std::stoll(z) > + std::stoull(z) + std::stod(z); > } The above code compiles and runs successfully on hppa64-hp-hpux11.11 with the patch. > > I'm not sure if double and long double are the same representation on this > target, but if they are then std::stold("0.0") should work too. Adding std::stold("0.0") to test, we get: bash-5.1$ gcc/xg++ -Bgcc/ -o xxx xxx.cc -I./hppa64-hp-hpux11.11/libstdc++-v3/include -I./hppa64-hp-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11 -I/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++ -Lhppa64-hp-hpux11.11/libstdc++-v3/src/.libs -O2 xxx.cc: In function 'int main()': xxx.cc:6:48: error: 'stold' is not a member of 'std' 6 | + std::stoull(z) + std::stod(z) + std::stold("0.0"); | ^~~~~ xxx.cc:2:1: note: 'std::stold' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 1 | #include <string> +++ |+#include <string> 2 | int main() On hpux, double and long double have different representations (they are same on linux). hpux11.11 has both strtod and strtold. strtold is checked for: /* Define to 1 if you have the `strtof' function. */ /* #undef HAVE_STRTOF */ /* Define to 1 if you have the `strtold' function. */ #define HAVE_STRTOLD 1 There doesn't seem to be a configure check for strtod.
next prev parent reply other threads:[~2023-07-13 15:14 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-13 9:40 [Bug libstdc++/110653] New: " redi at gcc dot gnu.org 2023-07-13 9:43 ` [Bug libstdc++/110653] " redi at gcc dot gnu.org 2023-07-13 13:46 ` redi at gcc dot gnu.org 2023-07-13 15:14 ` dave.anglin at bell dot net [this message] 2023-07-13 16:59 ` cvs-commit at gcc dot gnu.org 2023-07-13 17:09 ` redi at gcc dot gnu.org 2023-07-13 17:57 ` dave.anglin at bell dot net 2023-07-13 18:16 ` dave.anglin at bell dot net 2023-07-14 1:20 ` dave.anglin at bell dot net 2023-07-14 7:39 ` redi at gcc dot gnu.org 2023-07-14 9:58 ` redi at gcc dot gnu.org 2023-07-15 14:52 ` dave.anglin at bell dot net 2023-07-15 19:39 ` redi at gcc dot gnu.org 2023-07-19 10:04 ` cvs-commit at gcc dot gnu.org 2023-07-19 10:04 ` cvs-commit at gcc dot gnu.org 2023-07-19 10:04 ` cvs-commit at gcc dot gnu.org 2023-07-19 10:10 ` redi at gcc dot gnu.org 2023-07-19 10:10 ` redi at gcc dot gnu.org 2023-07-19 13:48 ` dave.anglin at bell dot net 2023-07-19 13:51 ` redi at gcc dot gnu.org 2023-07-21 18:25 ` dave.anglin at bell dot net 2023-07-21 18:27 ` redi at gcc dot gnu.org 2023-07-24 20:04 ` cvs-commit at gcc dot gnu.org 2023-08-10 19:25 ` danglin 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-110653-4-lhnVy62SwN@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).