Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-02-08 01:49:51


Merrill Cornish wrote:

> I have this problem that while program options works just fine for
> processing registered options, an unregistered option triggers a MS
> runtime exception (I'm using MinGW, so it uses MS runtime) that can't be
> caught at the C++ level. My store() function is shown below:
>
> po::store(po::command_line_parser(argc, argv).
> options(all_verbose).
> positional(pd).
> run(), vm);
>
> I saw the allow_unregistered() feature. I thought this would be a way to
> get all illegal command line options "out of the way" so they couldn't
> trigger the exception. So I modified the above to be:
>
> po::store(po::command_line_parser(argc, argv).
> options(all_verbose).
> positional(pd).
> allow_unregistered().
> run(), vm);
>
> However, putting an illegal argument on the command line, say --x, still
> gives the message, "This application has requested the Runtime to
> terminate it in an unusual way."
>
> Is an unregistered option triggering some sort of NULL access?

I really can't say. The library does not intentionally access NULL pointers.
There was a bug where 'store' would throw on unregistered options, and that
bug is present, I believe, in 1.33.1. However, that's *throw*, not anything
else. And that bug was fixed in CVS, btw.

Are you sure you have all the catch clauses in place. Can you run this under
debugger. In gdb, you can stop on throw statements by issuing

   catch throw

in the command line, and GUI debuggers on windows allow you to specify "stop
on throw" via GUI config options.

- 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