public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rsa at us dot ibm.com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/51364] New: C++ interoperability with ISO-C extension DFP types requires explicit typedefs. Date: Wed, 30 Nov 2011 18:58:00 -0000 [thread overview] Message-ID: <bug-51364-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51364 Bug #: 51364 Summary: C++ interoperability with ISO-C extension DFP types requires explicit typedefs. Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: rsa@us.ibm.com The following code requires explicit typedefs for _Decimal[32|64|128] in C++ programs in order to be able to use the ISO-C extension DFP types. #include <errno.h> #include <decimal> #include <stdio.h> #include <dfp/stdlib.h> int main() { char buffer[] = "0.0"; _Decimal64 x = -1.0DD; errno = 0; x = strtod64(buffer, NULL); printf("%0.16De\n", x); return 0; } /opt/at4.0/bin/g++ -g -isystem/opt/at4.0/include/c++/4.5.4/decimal -D__STDC_WANT_DEC_FP__ strtod.cpp -ldfp -o d In file included from strtod.cpp:9:0: /opt/at4.0/include/dfp/stdlib.h:37:8: error: '_Decimal32' does not name a type /opt/at4.0/include/dfp/stdlib.h:42:8: error: '_Decimal64' does not name a type /opt/at4.0/include/dfp/stdlib.h:47:8: error: '_Decimal128' does not name a type ... This is solved be declaring the following prior to the inclusion of <dfp/stdlib.h> (which is where the _Decimal types are first encountered): typedef float _Decimal32 __attribute__((mode(SD))); typedef float _Decimal64 __attribute__((mode(DD))); typedef float _Decimal128 __attribute__((mode(TD))); Should these typedefs be implicitly defined when using the std::decimal namespace?
next reply other threads:[~2011-11-30 18:43 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-11-30 18:58 rsa at us dot ibm.com [this message] 2011-11-30 19:09 ` [Bug c++/51364] " redi at gcc dot gnu.org 2011-11-30 21:46 ` rsa at us dot ibm.com 2011-11-30 21:46 ` janis at gcc dot gnu.org 2011-11-30 21:59 ` janis at gcc dot gnu.org 2011-12-09 16:06 ` rsa at us dot ibm.com 2011-12-17 21:14 ` mingodad at gmail dot com 2011-12-18 6:28 ` janis at gcc dot gnu.org 2011-12-19 0:10 ` mingodad at gmail dot com 2011-12-19 0:27 ` redi at gcc dot gnu.org 2011-12-19 3:33 ` mingodad at gmail dot com 2011-12-19 20:45 ` janis at gcc dot gnu.org 2012-01-18 20:21 ` rsa at us dot ibm.com
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-51364-4@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).