Boost C++ Libraries: Ticket #10838: Missing std:: qualifier for strlen calls in string_ref_test2.cpp https://svn.boost.org/trac10/ticket/10838 <p> Compiling with Oracle Solaris Studio on Solaris 11.2, we see </p> <p> "../libs/utility/test/string_ref_test2.cpp", line 21: Error: The function "strlen" must have a prototype. </p> <p> "../libs/utility/test/string_ref_test2.cpp", line 51: Error: The function "strlen" must have a prototype. </p> <p> "../libs/utility/test/string_ref_test2.cpp", line 162: Error: The function "strlen" must have a prototype. </p> <p> "../libs/utility/test/string_ref_test2.cpp", line 183: Error: The function "strlen" must have a prototype. </p> <p> The file libs/utility/test/string_ref_test2.cpp includes &lt;cstring&gt;, however strlen needs to be qualified with std:: </p> <p> The diffs are 21c21 &lt; const size_t sz = strlen ( arg ); --- </p> <blockquote class="citation"> <blockquote> <p> const size_t sz = std::strlen ( arg ); </p> </blockquote> </blockquote> <p> 51c51 &lt; const size_t sz = strlen ( arg ); --- </p> <blockquote class="citation"> <blockquote> <p> const size_t sz = std::strlen ( arg ); </p> </blockquote> </blockquote> <p> 162c162 &lt; p = arg + strlen ( arg ) - 1; --- </p> <blockquote class="citation"> <blockquote> <p> p = arg + std::strlen ( arg ) - 1; </p> </blockquote> </blockquote> <p> 183c183 &lt; p = arg + strlen ( arg ) - 1; --- </p> <blockquote class="citation"> <blockquote> <p> p = arg + std::strlen ( arg ) - 1; </p> </blockquote> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10838 Trac 1.4.3 Marshall Clow Tue, 02 Dec 2014 19:14:34 GMT owner changed https://svn.boost.org/trac10/ticket/10838#comment:1 https://svn.boost.org/trac10/ticket/10838#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">No-Maintainer</span> to <span class="trac-author">Marshall Clow</span> </li> </ul> <p> Ok, I'm confused. </p> <p> <code>&lt;cstring&gt;</code> includes <code>&lt;string.h&gt;</code>, which defines strlen, right? </p> <p> All that <code>&lt;cstring&gt;</code> does is <code>using ::strlen;</code> (which hoists it from the global namespace into <code>namespace std</code>) </p> Ticket Aparna Kumta <Aparna.Kumta@…> Tue, 02 Dec 2014 20:31:56 GMT <link>https://svn.boost.org/trac10/ticket/10838#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10838#comment:2</guid> <description> <p> Per the C++ standard, </p> <p> D.5 C standard library headers </p> <p> 2 Every C header, each of which has a name of the form name.h, behaves as if each name placed in the standard library namespace by the corresponding cname header is placed within the global namespace scope. It is unspecified whether these names are first declared or defined within namespace scope (3.3.6) of the namespace std and are then injected into the global namespace scope by explicit using-declarations (7.3.3). </p> <p> 3 [ Example: The header &lt;cstdlib&gt; assuredly provides its declarations and definitions within the namespace std. It may also provide these names within the global namespace. The header &lt;stdlib.h&gt; assuredly provides the same declarations and definitions within the global namespace, much as in the C Standard. It may also provide these names within the namespace std. —end example ] </p> </description> <category>Ticket</category> </item> <item> <author>Aparna Kumta <aparna.kumta@…></author> <pubDate>Wed, 25 Feb 2015 18:57:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10838#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10838#comment:3</guid> <description> <p> In standard C++, names declared in the &lt;cname&gt; version of the C &lt;name.h&gt; headers are only in namespace std. However, gcc puts the names in the global namespace. </p> <p> Line 54 of this file already qualifies strlen with std:: qualifier and as seen above, there is no error message generated for this line. </p> <blockquote> <p> 54: const char *p = arg + std::strlen ( arg ) - 1; </p> </blockquote> <p> I have just submitted a pull request for this. </p> <p> Thanks. </p> </description> <category>Ticket</category> </item> <item> <author>Aparna Kumta <aparna.kumta@…></author> <pubDate>Wed, 25 Feb 2015 18:59:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10838#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10838#comment:3</guid> <description> <p> In standard C++, names declared in the &lt;cname&gt; version of the C &lt;name.h&gt; headers are only in namespace std. However, gcc puts the names in the global namespace. </p> <p> Line 54 of this file already qualifies strlen with std:: qualifier and as seen above, there is no error message generated for this line. </p> <blockquote> <p> 54: const char *p = arg + std::strlen ( arg ) - 1; </p> </blockquote> <p> I have just submitted a pull request for this. </p> <p> Thanks. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Sat, 28 Feb 2015 06:26:12 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10838#comment:4 https://svn.boost.org/trac10/ticket/10838#comment:4 <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">fixed</span> </li> </ul> Ticket