its interesting to note that when I use <br>"help,h" n is 8<br>when I use <br>"help" ( 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> <<a href="mailto:jhughes@linx.co.uk">jhughes@linx.co.uk</a>> 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>> -----Original Message-----<br>> From: <a href="mailto:boost-users-bounces@lists.boost.org">boost-users-bounces@lists.boost.org</a><br>> [mailto:<a href="mailto:boost-users-bounces@lists.boost.org">boost-users-bounces@lists.boost.org </a>] On Behalf Of<br>> Vladimir Prus<br>> Sent: 17 July 2003 15:46<br>> To: <a href="mailto:boost-users@lists.boost.org">boost-users@lists.boost.org</a><br>> Subject: Re: [Boost-users] Program_options assertion failure <br>><br>> Johnathan Bunn wrote:<br>><br>> > im having an issue with a project using visual studio pro 2005<br>> ><br>> > if it makes a difference the librarys im using are Qt,<br>> pdflib, boost, <br>> > and some crystal com stuff thorugh activex<br>> ><br>> > my problem is that when I build in release my command line args are<br>> > parsed fine and my application behaves as expected.<br>> > <br>> > when I build in debug mode, I get an asertion failure as follows<br>> ><br>> > Assertion failed: n == name.size()-2, file<br>> > libs\program_options\src\options_description.cpp, line 122<br> ><br>> Well, here's the code where assert happens:<br>><br>> option_description&<br>> option_description::set_name(const char* _name)<br>> {<br>> std::string name(_name);<br> > string::size_type n = name.find(',');<br>> if (n != string::npos) {<br>> assert(n == name.size()-2);<br>> m_long_name = name.substr(0, n);<br>> m_short_name = '-' + name.substr(n+1,1);<br>> } else {<br>> m_long_name = name;<br>> }<br>> return *this;<br>> }<br>><br>> We have identified that _name is "help,h", and the 'n' <br>> variable ends up as 8 -- which is twice as much as I've<br>> expected. There's some Unicode option enabled in project<br>> settings, but I have no idea why that would affect char* values.<br>><br> > > I am completely stumped and sought help on the #boost irc channel<br>> ><br>> > volodya and others on that channel were stumped as well<br>><br>> Yeah, I have no idea about this MSVC behaviour, so if some <br>> msvc user has any input, that would be great.<br>><br>> - Volodya<br>><br><br>I don't have VC2005 so cannot try this, but I would suggest debugging<br>through at the disassembly level and seeing what'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'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. 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. 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