1

My searching has been fruitless so far, so I suspect the answer is "no", but I'm new to Boost, so maybe I'm missing something.

Is there documentation for Boost libraries about exceptions the methods may throw? I can't find any docs on a general Boost policy about this, and of the parts I've looked at so far, many methods lack any docs about it.

My specific case is for boost::program_options::parse_command_line, which can throw invalid_command_line_syntax. This seems like reasonable behavior.

But: How was I supposed to know that might happen? I can't find this knowledge anywhere in the Boost docs or in the header files.

It looks like the only way is to search the web for usage examples and see what other people do (or try running it and see what happens).

Is there documentation on this?

Chris
  • 4,734
  • 2
  • 19
  • 26

1 Answers1

1

Here is the link to the list of program_options errors. You can also click on the link on all the errors to see how they work, also since boost is open source you can just go to the file and see exactly how it is implemented. boost is relatively well documented so i'm assuming every library has this documentation. Also read this link on boost's opinion on exception specification.

aaronman
  • 18,343
  • 7
  • 63
  • 78
  • 1
    -1 for "boost is relatively well documented". Boost's doc is terrible, it doesn't even have a search function (no, google search doesn't count). – Stephan Dollberg Nov 25 '13 at 19:48
  • 1
    @bamboon your seriously gonna downvote for that, it's an opinion, I've never found boost that hard to use and for such a big library it's not bad – aaronman Nov 25 '13 at 19:49
  • @bamboon Don't blame boost documentation for yourself not being able to navigate it! You'll might learn to understand the concepts first, before you're going to find s.th. in detail. – πάντα ῥεῖ Nov 25 '13 at 19:52
  • 1
    Yes, I did, I don't feel that good about it, but calling boost doc "well documented" makes my brain hurt. – Stephan Dollberg Nov 25 '13 at 19:52
  • @bamboon your free to have your opinion on it but downvoting for an aside comment is rude, also consider how difficult it is to make navigation for a library like boost's, which is maintained by hundreds of people, has no standard and is quite huge – aaronman Nov 25 '13 at 19:54
  • @bamboon There's a required detail API documentation for any library that claims to be part of boost. Usually besides this there's a quick start, tutorial or at least concept description for each library (never seen one without them) IIRC. – πάντα ῥεῖ Nov 25 '13 at 19:57
  • @aaronman: That's not what I was looking for, but it's something. Thanks. – Chris Nov 25 '13 at 19:58
  • @Chris I understand, you want to know exactly which functions can throw which exceptions right, you could just grep the library – aaronman Nov 25 '13 at 20:00
  • @Chris you might wanna read [this link](http://www.boost.org/development/requirements.html#Exception-specification) which I also added to the answer – aaronman Nov 25 '13 at 20:07
  • 2
    @aaronman Using the language's throw statement is one way to document the behavior. But not the only one. I'd personally prefer to use the language feature since it's available, but even in its absence it would help me to have the info in the human-readable docs. – Chris Nov 25 '13 at 20:17
  • 1
    @chris as I said you can always grep for throw if your so concerned – aaronman Nov 25 '13 at 20:18
  • @Chris I've updated my answer with a link to some more explanation why throw specifications are obsolete/deprecated. – πάντα ῥεῖ Nov 25 '13 at 20:26
  • @aaronman Yes, reading/grepping the source is always an option. But it's not documentation, which is what I was hoping for. – Chris Nov 25 '13 at 20:55