Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2007-08-29 10:46:02


Johnathan Bunn wrote:

> im having an issue with a project using visual studio pro 2005
>
> if it makes a difference the librarys im using are
> Qt, pdflib, boost, and some crystal com stuff thorugh activex
>
> my problem is that when I build in release my command line args are parsed
> fine and my application behaves as expected.
>
> when I build in debug mode, I get an asertion failure as follows
>
> Assertion failed: n == name.size()-2, file
> libs\program_options\src\options_description.cpp, line 122

Well, here's the code where assert happens:

    option_description&
    option_description::set_name(const char* _name)
    {
        std::string name(_name);
        string::size_type n = name.find(',');
        if (n != string::npos) {
            assert(n == name.size()-2);
            m_long_name = name.substr(0, n);
            m_short_name = '-' + name.substr(n+1,1);
        } else {
            m_long_name = name;
        }
        return *this;
    }

We have identified that _name is "help,h", and the 'n' variable ends up
as 8 -- which is twice as much as I've expected. There's some Unicode
option enabled in project settings, but I have no idea why that would
affect char* values.
        
> I am completely stumped and sought help on the #boost irc channel
>
> volodya and others on that channel were stumped as well

Yeah, I have no idea about this MSVC behaviour, so if some msvc user
has any input, that would be great.

- Volodya


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net