its interesting to note that when I use <br>&quot;help,h&quot; n is 8<br>when I use <br>&quot;help&quot; ( no ,h ), help is some random number often between 700 and 780<br><br>im not sure how string::find could be returning that and I really dont have any clue how to tell whats goign on in the registers.. im not that good with a debugger.. I guess now is a good time to learn...
<br><br><br><br><div><span class="gmail_quote">On 8/29/07, <b class="gmail_sendername">Hughes, James</b> &lt;<a href="mailto:jhughes@linx.co.uk">jhughes@linx.co.uk</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>&gt; -----Original Message-----<br>&gt; From: <a href="mailto:boost-users-bounces@lists.boost.org">boost-users-bounces@lists.boost.org</a><br>&gt; [mailto:<a href="mailto:boost-users-bounces@lists.boost.org">boost-users-bounces@lists.boost.org
</a>] On Behalf Of<br>&gt; Vladimir Prus<br>&gt; Sent: 17 July 2003 15:46<br>&gt; To: <a href="mailto:boost-users@lists.boost.org">boost-users@lists.boost.org</a><br>&gt; Subject: Re: [Boost-users] Program_options assertion failure
<br>&gt;<br>&gt; Johnathan Bunn wrote:<br>&gt;<br>&gt; &gt; im having an issue with a project using visual studio pro 2005<br>&gt; &gt;<br>&gt; &gt; if it makes a difference the librarys im using are Qt,<br>&gt; pdflib, boost,
<br>&gt; &gt; and some crystal com stuff thorugh activex<br>&gt; &gt;<br>&gt; &gt; my problem is that when I build in release my command line args are<br>&gt; &gt; parsed fine and my application behaves as expected.<br>&gt; &gt;
<br>&gt; &gt; when I build in debug mode, I get an asertion failure as follows<br>&gt; &gt;<br>&gt; &gt; Assertion failed: n == name.size()-2, file<br>&gt; &gt; libs\program_options\src\options_description.cpp, line 122<br>
&gt;<br>&gt; Well, here&#39;s the code where assert happens:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; option_description&amp;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; option_description::set_name(const char* _name)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::string name(_name);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string::size_type n = name.find(&#39;,&#39;);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (n != string::npos) {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; assert(n == name.size()-2);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_long_name = name.substr(0, n);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_short_name = &#39;-&#39; + 
name.substr(n+1,1);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_long_name = name;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return *this;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt;<br>&gt; We have identified that _name is &quot;help,h&quot;, and the &#39;n&#39;
<br>&gt; variable ends up as 8 -- which is twice as much as I&#39;ve<br>&gt; expected. There&#39;s some Unicode option enabled in project<br>&gt; settings, but I have no idea why that would affect char* values.<br>&gt;<br>
&gt; &gt; I am completely stumped and sought help on the #boost irc channel<br>&gt; &gt;<br>&gt; &gt; volodya and others on that channel were stumped as well<br>&gt;<br>&gt; Yeah, I have no idea about this MSVC behaviour, so if some
<br>&gt; msvc user has any input, that would be great.<br>&gt;<br>&gt; - Volodya<br>&gt;<br><br>I don&#39;t have VC2005 so cannot try this, but I would suggest debugging<br>through at the disassembly level and seeing what&#39;s happening in the
<br>registers, and hence where the 8 comes from - perhaps a bad type<br>conversion somewhere - that would show up a compiler fault. Usual<br>difference between release and debug on VS is that debug code has better<br>default initialisation of variables, but the code look fine. I would
<br>suspect a compiler issue, I&#39;ve certainly seem similar when using older<br>versions of VS.<br><br>Actually a thought just occurred - are the libraries built with a<br>different unicode setting to the application, which may affect the
<br>definition (and bit size) of the string::size_type (guessing....)? Check<br>the return value (at register level) from name.find() and compare with<br>what is assigned to n.<br><br>James<br><br><br><br>This message (including any attachments) contains confidential
<br>and/or proprietary information intended only for the addressee.<br>Any unauthorized disclosure, copying, distribution or reliance on<br>the contents of this information is strictly prohibited and may<br>constitute a violation of law.&nbsp;&nbsp;If you are not the intended
<br>recipient, please notify the sender immediately by responding to<br>this e-mail, and delete the message from your system.&nbsp;&nbsp;If you<br>have any questions about this e-mail please notify the sender<br>immediately.<br>_______________________________________________
<br>Boost-users mailing list<br><a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br><a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users">http://lists.boost.org/mailman/listinfo.cgi/boost-users
</a><br></blockquote></div><br><br clear="all"><br>-- <br>To follow the Path,<br>Look to the master,<br>Walk with the master,<br>See through the master,<br>Become the master