Boost C++ Libraries: Ticket #5807: Debug build of the program asserts calling iscntrl(c) in boost::spirit::detail::token_printer_debug_for_chars::print(), with c == -127 https://svn.boost.org/trac10/ticket/5807 <p> When using a hexidecimal string that contains a negative value with the attached parser causes an assert to be thrown when calling iscntrl(c) in boost::spirit::detail::token_printer_debug_for_chars::print(), with c == -127. Disabling debug output allows the program to succeed and produce the following output: </p> <p> successfully parsed 33026 772 </p> <p> Attached is a sample program that causes the error. The program was tested with Visual Studio 2010 (SP1) and Visual Studio 2008 (Boost 1.45). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5807 Trac 1.4.3 Stephen Torri <stephen.torri@…> Tue, 23 Aug 2011 14:02:57 GMT attachment set https://svn.boost.org/trac10/ticket/5807 https://svn.boost.org/trac10/ticket/5807 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test.cpp</span> </li> </ul> <p> Standalone program that exposes the assert in iscntrl </p> Ticket anonymous Tue, 23 Aug 2011 14:39:46 GMT <link>https://svn.boost.org/trac10/ticket/5807#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5807#comment:1</guid> <description> <p> I changed boost/spirit/home/support/attributes.hpp at line 950 to be: </p> <p> else if ( c &gt;= 0 &amp;&amp; c &lt; 127 &amp;&amp; iscntrl(c)) </p> <blockquote> <p> o &lt;&lt; "<br />" &lt;&lt; std::oct &lt;&lt; static_cast&lt;int&gt;(c); </p> </blockquote> <p> I read that the windows api expects that to be a value within the range of 0x00 - 0x1F or 0x7F despite the fact that the input parameter type for that function is a regular integer. The linux api also uses a int. So we cannot rely on the type checking to save us here. We have to constrain the range of values for 'c' to be within the range of 0 and 126. </p> <p> Stephen </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Tue, 23 Aug 2011 23:46:18 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5807#comment:2 https://svn.boost.org/trac10/ticket/5807#comment:2 <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