Boost C++ Libraries: Ticket #11392: boost::program_options accepting switch-options that match the beginning of defined option, but is not full option typed out. https://svn.boost.org/trac10/ticket/11392 <p> With: </p> <blockquote> <p> namespace po = boost::program_options; po::options_description desc ("options"); desc.add_options () </p> <blockquote> <p> ( "help,h", "print this help message") ( "config,c", po::value&lt;ustring&gt;(), "config file, default: $XDG_CONFIG_HOME/astroid/config") ( "new-config,n", "make new default config, then exit") ( "mailto,m", po::value&lt;ustring&gt;(), "compose mail with mailto url or address") ( "no-auto-poll", "do not poll automatically"); </p> </blockquote> </blockquote> <blockquote> <p> po::variables_map vm; </p> </blockquote> <blockquote> <p> bool show_help = false; </p> </blockquote> <blockquote> <p> try { </p> <blockquote> <p> po::store ( po::parse_command_line (argc, argv, desc), vm ); </p> </blockquote> <p> } catch (po::unknown_option &amp;ex) { </p> <blockquote> <p> cout &lt;&lt; "unknown option" &lt;&lt; endl; cout &lt;&lt; ex.what() &lt;&lt; endl; show_help = true; </p> </blockquote> </blockquote> <blockquote> <p> } </p> </blockquote> <p> running: </p> <p> ./program --asdf </p> <p> fails, but running: </p> <p> ./program --hel </p> <p> is parsed as --help. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11392 Trac 1.4.3 John Maddock Fri, 12 Jun 2015 18:10:06 GMT component changed; owner set https://svn.boost.org/trac10/ticket/11392#comment:1 https://svn.boost.org/trac10/ticket/11392#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Vladimir Prus</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">program_options</span> </li> </ul> Ticket Vladimir Prus Mon, 15 Jun 2015 07:00:41 GMT <link>https://svn.boost.org/trac10/ticket/11392#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11392#comment:2</guid> <description> <p> Thanks for the report! </p> <p> Why do you believe this to be a bug? The default_style, defined in cmdline.hpp, does include "allow_guessing" bit, so it appears the library behaves as designed. </p> </description> <category>Ticket</category> </item> <item> <author>eg@…</author> <pubDate>Mon, 15 Jun 2015 07:07:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11392#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11392#comment:3</guid> <description> <p> Oh, darn. Didn't realize it was configurable. Thanks for the explanation! </p> <p> gaute </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Mon, 15 Jun 2015 07:09:07 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11392#comment:4 https://svn.boost.org/trac10/ticket/11392#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Good that this turned to be easy to solve! </p> Ticket eg@… Mon, 15 Jun 2015 07:09:12 GMT <link>https://svn.boost.org/trac10/ticket/11392#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11392#comment:3</guid> <description> <p> Oh, darn. Didn't realize it was configurable. Thanks for the explanation! </p> <p> gaute </p> </description> <category>Ticket</category> </item> </channel> </rss>