Boost logo

Boost Users :

From: Merrill Cornish (merrill.cornish_at_[hidden])
Date: 2005-11-21 16:55:14


I'm making progess on using program_options. Using std::exception&
gave me the real error message; but problems still remain.

    po::options_description desc("Options");
    desc.add_options()
        ("help,h", " Display this help message.")
        ("version", " Display the version... .")
        ("limit", po::value<unsigned int>()->default_value(1),
                        " This is the concurrency limit ...") );

     // specify the single, required graph file positional parameter
    po::positional_options_description pd;
    pd.add("graph_file", 1);
    po::variables_map vm;

    po::store(po::command_line_parser(argc, argv).
                  options(desc). positional(pd).run(), vm);
    po::notify(vm);

    //... code that references vm...

I still can't get the positional parameter, but I've got other problem to
research first.

The options_descriptions above defines --limit as an unsigned integer
with a default value of 1. It does get a default value of 1, and it will let
you specify another unsigned integer value. But if you specify a
non-unisgned integer (e.g., --limit=xxx or --limit=-5), then it bypasses
the exception handling and calls Dr. Watson. The reported error is a
wild write to unwritable memory.

Any ideas how to chase this problem?

Merrill


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