Boost C++ Libraries: Ticket #8860: Logically dead code in default_locale.cpp https://svn.boost.org/trac10/ticket/8860 <p> In file : <a class="ext-link" href="http://svn.boost.org/svn/boost/trunk/libs/locale/src/util/default_locale.cpp"><span class="icon">​</span>http://svn.boost.org/svn/boost/trunk/libs/locale/src/util/default_locale.cpp</a> </p> <pre class="wiki">std::string get_system_locale(bool use_utf8) { char const *lang = 0; if(!lang || !*lang) lang = getenv("LC_CTYPE"); -----------Some Code ------------------ </pre><table class="wiki"> <tr>Here lang is initialized to 0.So, In condition (!lang <td> !*lang) (!lang) is always true, the condition (!*lang) will never be reached and hence dead-code. </td></tr></table> <p> Modify the condition as below : </p> <pre class="wiki"> if(!lang) lang = getenv("LC_CTYPE"); </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8860 Trac 1.4.3 Artyom Beilis Thu, 13 Jul 2017 14:34:10 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8860#comment:1 https://svn.boost.org/trac10/ticket/8860#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> It is for code look nice - compiler will optimize it out. </p> Ticket