[Bug c++/51364] C++ interoperability with ISO-C extension DFP types requires explicit typedefs.

rsa at us dot ibm.com gcc-bugzilla@gcc.gnu.org
Wed Nov 30 21:46:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51364

--- Comment #3 from Ryan S. Arnold <rsa at us dot ibm.com> 2011-11-30 21:40:47 UTC ---
(In reply to comment #2)
> The definitions that n2732 wants to add are typedefs to the C++ classes, but
> interoperability with C requires the typedefs using modes that Ryan shows.  I
> never got a good answer from the authors of the C++ technical report about how
> to provide C/C++ interoperability.
> 
> I'm not sure what dfp/stdlib.h is, but perhaps it should define typedefs if
> __cplusplus is defined.

The spec defines the following to be included in float.h for C-compatibility.

3.4.2 Header <float.h> synopsis  
      // C-compatibility convenience typedefs:  
      typedef std::decimal::decimal32  _Decimal32;  
      typedef std::decimal::decimal64  _Decimal64;  
      typedef std::decimal::decimal128 _Decimal128;

Adding these to the example code solves the issue as well.  If you feel these
don't belong in float.h as the spec defines then I could put them in each of
the dfp/ headers under the __cplusplus guard.



More information about the Gcc-bugs mailing list