Opened 9 years ago

Closed 5 years ago

#8860 closed Bugs (wontfix)

Logically dead code in default_locale.cpp

Reported by: Gaurav Gupta <g.gupta@…> Owned by: Artyom Beilis
Milestone: To Be Determined Component: locale
Version: Boost 1.54.0 Severity: Optimization
Keywords: Cc:

Description

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");

Change History (1)

comment:1 by Artyom Beilis, 5 years ago

Resolution: wontfix
Status: newclosed

It is for code look nice - compiler will optimize it out.

Note: See TracTickets for help on using tickets.