Boost C++ Libraries: Ticket #2613: Default arguments break word-wrapping. https://svn.boost.org/trac10/ticket/2613 <p> The attached example program demonstrates the problem. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2613 Trac 1.4.3 anonymous Wed, 24 Dec 2008 14:28:11 GMT attachment set https://svn.boost.org/trac10/ticket/2613 https://svn.boost.org/trac10/ticket/2613 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test.cpp</span> </li> </ul> <p> Run to see the broken help output. </p> Ticket Vladimir Prus Wed, 24 Dec 2008 16:28:31 GMT <link>https://svn.boost.org/trac10/ticket/2613#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2613#comment:1</guid> <description> <p> Please specify how the produced output differs from expected output, and why you expect the output you expect. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Simons</dc:creator> <pubDate>Wed, 24 Dec 2008 17:12:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2613#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2613#comment:2</guid> <description> <p> With Boost 1.37.0, the attached program generates the following output: </p> <pre class="wiki">$ g++ test.cpp -lboost_program_options &amp;&amp; ./a.out | Supported options: | --help this is a sufficiently long text to requ | ire word-wrapping </pre><p> Look closely at the description of the "--help" option. You'll find that word-wrapping is performed in the middle of the word, i.e. "require" is broken apart as "requ-ire". This is contrary to what I expect because of the rules of syllabication, which you'll find described at <a class="ext-link" href="http://en.wikipedia.org/wiki/Syllabification"><span class="icon">​</span>http://en.wikipedia.org/wiki/Syllabification</a>. Now, those rules are somewhat complex and might be considered beyond the scope of a command-line argument parsing library. Thus, most code that needs to perform word-wrapping opts to use a simpler approximation, i.e. to break lines apart at *whitespace*. If you check out your source code, "options_description.cpp", you'll find that you have implemented an algorithm that does this, but unfortunately it appears that your code fails to take the length of the default argument into account. I say this because the algorithm works just fine when there's no default argument. When there is one, word-wrapping does not work fine. </p> <p> If you need further clarification, please don't hesitate to ask. </p> </description> <category>Ticket</category> </item> <item> <author>s.ochsenknecht@…</author> <pubDate>Mon, 09 Nov 2009 14:43:29 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/2613 https://svn.boost.org/trac10/ticket/2613 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">patch_ticket2613.diff</span> </li> </ul> <p> patch </p> Ticket s.ochsenknecht@… Mon, 09 Nov 2009 14:44:49 GMT <link>https://svn.boost.org/trac10/ticket/2613#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2613#comment:3</guid> <description> <p> I just attached a patch which improves the word wrapping (small fix). I also added a test case for word wrapping. </p> <p> Please comment. </p> </description> <category>Ticket</category> </item> <item> <author>s.ochsenknecht@…</author> <pubDate>Mon, 09 Nov 2009 15:28:25 GMT</pubDate> <title>cc changed https://svn.boost.org/trac10/ticket/2613#comment:4 https://svn.boost.org/trac10/ticket/2613#comment:4 <ul> <li><strong>cc</strong> <span class="trac-author">s.ochsenknecht@…</span> added </li> </ul> Ticket Peter Simons Mon, 09 Nov 2009 16:07:41 GMT milestone changed https://svn.boost.org/trac10/ticket/2613#comment:5 https://svn.boost.org/trac10/ticket/2613#comment:5 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.38.0</span> → <span class="trac-field-new">Boost 1.41.0</span> </li> </ul> <p> The patch applies cleanly to the current SVN HEAD, and it does fix the problem in my test program. Looks good to me. Thank you very much. </p> Ticket Vladimir Prus Mon, 09 Nov 2009 16:12:33 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2613#comment:6 https://svn.boost.org/trac10/ticket/2613#comment:6 <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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/57517" title="Fix wordwrapping in presense of default parameters. Fixes #2613. ...">[57517]</a>) Fix wordwrapping in presense of default parameters. </p> <p> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2613" title="#2613: Bugs: Default arguments break word-wrapping. (closed: fixed)">#2613</a>. Patch from Sascha Ochsenknecht. </p> Ticket Sascha Ochsenknecht Sun, 06 Dec 2009 12:20:30 GMT milestone changed https://svn.boost.org/trac10/ticket/2613#comment:7 https://svn.boost.org/trac10/ticket/2613#comment:7 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.41.0</span> → <span class="trac-field-new">Boost 1.42.0</span> </li> </ul> Ticket