Re: [Boost-bugs] [Boost C++ Libraries] #7068: Compiler warnings in date_time

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7068: Compiler warnings in date_time
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-12 00:53:00


#7068: Compiler warnings in date_time
----------------------------------+------------------------
  Reporter: ZenJu <zhnmju123@…> | Owner: az_sw_dude
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: date_time
   Version: Boost 1.51.0 | Severity: Problem
Resolution: invalid | Keywords:
----------------------------------+------------------------

Comment (by andrewtrapani@…):

 Hi,

 I ran across this today and wanted to offer an opinion.
 In the example above by marshall, the default catches everything not
 listed and returns NaN.

 Now if we add a new enum value "foobar", it will automatically return NaN.
 But what if we forgot to edit the above switch when we actually needed
 foobar to return foobar_value() as in some value other than NaN?

 The flipside is now we are forcing the coder to write out all of the
 cases.

 {{{
     switch (sv) {
       case not_a_date_time: return not_a_number();
       case neg_infin: return neg_infinity();
       case pos_infin: return pos_infinity();
       case max_date_time: return (max)();
       case min_date_time: return (min)();
       case foobar: return foobar_value();
       case foo:
       case bar:
       case fizz:
       //and so on all fall into default or else we get a bunch of warnings
       default: return not_a_number();
     }
 }}}

 It looks like this feature is not ready for usage unless something changes
 about the enum declaration options in newer C++ version.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7068#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC