This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/69462] New: FLT_EVAL_METHOD and DECIMAL_DIG missing in float.h


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69462

            Bug ID: 69462
           Summary: FLT_EVAL_METHOD and DECIMAL_DIG missing in float.h
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vogt at linux dot vnet.ibm.com
  Target Milestone: ---

The macros FLT_EVAL_METHOD and DECIMAL_DIG (required by C++-11, maybe earlier)
are present when including cfloat but not when including float.h:

  -- y.C --
  #include <float.h>
  int x = FLT_EVAL_METHOD;
  int y = DECIMAL_DIG;
  ---------

  -- z.C --
  #include <cfloat>
  int x = FLT_EVAL_METHOD;
  int y = DECIMAL_DIG;
  ---------

==>

  $ g++ -std=c++11 z.C -S && echo ok
  ok

  $ g++ -std=c++11 y.C -S
  y.C:2:9: error: 'FLT_EVAL_METHOD' was not declared in this scope
  ...
  y.C:3:9: error: 'DECIMAL_DIG' was not declared in this scope
  ...

--

cfloat has this bit of code that is missing from float.h:

-- snip --
#ifndef _GLIBCXX_CFLOAT
#define _GLIBCXX_CFLOAT 1

#if __cplusplus >= 201103L
#  ifndef DECIMAL_DIG
#    define DECIMAL_DIG __DECIMAL_DIG__
#  endif
#  ifndef FLT_EVAL_METHOD
#    define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#  endif
#endif
#endif
-- snip --

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]