[Boost-bugs] [Boost C++ Libraries] #7111: Switch case's default missing in date_time

Subject: [Boost-bugs] [Boost C++ Libraries] #7111: Switch case's default missing in date_time
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-10 13:01:19


#7111: Switch case's default missing in date_time
------------------------------------------------+---------------------------
 Reporter: Gaurav Gupta <g.gupta@…> | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.51.0 | Severity: Problem
 Keywords: |
------------------------------------------------+---------------------------
 In file boost/date_time/date_formatting.hpp in following code block,
 '''default case''' of switch condition is missing.Switch case should not
 be used without default case ideally.In case of default, code should break
 from the loop.

 {{{
 static ostream_type& format_month(const month_type& month,
                                       ostream_type &os)
     {
       switch (format_type::month_format())
       {
         case month_as_short_string:
         {
           os << month.as_short_string();
           break;
         }
         case month_as_long_string:
         {
           os << month.as_long_string();
           break;
         }
         case month_as_integer:
         {
           os << std::setw(2) << std::setfill(os.widen('0')) <<
 month.as_number();
           break;
         }

       }
       return os;
     } // format_month
   };
 }}}

 Attached patch is the fix for it.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7111>
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:10 UTC