[Boost-bugs] [Boost C++ Libraries] #8860: Logically dead code in default_locale.cpp

Subject: [Boost-bugs] [Boost C++ Libraries] #8860: Logically dead code in default_locale.cpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-07-19 13:09:08


#8860: Logically dead code in default_locale.cpp
--------------------------------------+--------------------------
 Reporter: Gaurav Gupta <g.gupta@…> | Owner: artyom
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: locale
  Version: Boost 1.54.0 | Severity: Optimization
 Keywords: |
--------------------------------------+--------------------------
 In file :
 http://svn.boost.org/svn/boost/trunk/libs/locale/src/util/default_locale.cpp


 {{{
 std::string get_system_locale(bool use_utf8)
             {
                 char const *lang = 0;
                 if(!lang || !*lang)
                   lang = getenv("LC_CTYPE");
         -----------Some Code ------------------
 }}}

 Here lang is initialized to 0.So, In condition (!lang || !*lang) (!lang)
 is always true, the condition (!*lang) will never be reached and hence
 dead-code.

 Modify the condition as below :

 {{{
       if(!lang)
          lang = getenv("LC_CTYPE");
 }}}

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