Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2007-12-03 15:55:55


sj_at_[hidden] wrote:

> Hello,
>
> When I try to output options_description to cout (response to --help
> option, to show all available options) I get an assertion in in xstring
> header file. It's caused by execution format_paragraph function in
> option_description.cpp line 381. I narrowed down the problem to the
> length of the description for an option. This is the code:
>
> #include <boost/program_options.hpp>
> namespace po = boost::program_options;
> int main(int argc, char **argv){
> po::options_description desc("t");
> desc.add_options()("h",
> "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZ");
> po::variables_map vm;
> po::store(po::parse_command_line(argc, argv, desc), vm);
> po::notify(vm);
> if(vm.count("h")){std::cout<<desc<<"\n"; return 1;}
> return 0;
> }
> If I remove last Z in the description of h parameter the program works,
> otherwise it crashes. If I replace the message with some words, meaning
> if spaces are present, it still crashes (that's how I originally
> discovered the problem). What am I doing wrong, or how can I avoid this
> situation (other than decreasing the length of the descriptions for all
> of my parameters).
>
> I'm using boost 1.33.1 (how can I find out what was done to
> program_options in 1.34.1?) and Microsoft Visual Studio 2005
> Professional. The project is compiled as Multi-threaded DLL

I believe this problem is fixed in 1.34.1.

- 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