Boost logo

Boost :

From: SourceForge.net (noreply_at_[hidden])
Date: 2006-07-25 10:02:35


Bugs item #1528399, was opened at 2006-07-25 16:02
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1528399&group_id=7586

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Enrico Scholz (ensc)
Assigned to: Nobody/Anonymous (nobody)
Summary: [program_options] Endless loop with long default arguments

Initial Comment:
when using a po::value with a representation of the default value
having a certain length, 'std::cout << opts' will stuck in an endless
loop.

E.g.

-----
#include <boost/program_options.hpp>
#include <string>
#include <iostream>

namespace po = boost::program_options;

int main(int argc, char *argv[])
{
  po::options_description opts;
  opts.add_options()
    ("cfgfile,c",
     po::value<std::string>()->default_value("/usr/local/etc/myprogramXXXXXXXXX/configuration.conf"),
     "the configfile");

  std::cout << opts;
}
-----

| $ rpm -q boost
| boost-1.33.1-5
|
| $ g++ foo.c -lboost_program_options
| $ strace ./a.out
| ...
| write(1, " -c [ --cfgfile ] arg (=/usr/lo"..., 80 -c [ --cfgfile ] arg (=/usr/local/etc/myprogramXXXXXXXXX/configuration.conf)
| ) = 80
| write(1, " "..., 80
| ) = 80
| write(1, " "..., 80
| ) = 80
| ...

Removing one 'X' will result in an ugly

| -c [ --cfgfile ] arg (=/usr/local/etc/myprogramXXXXXXXX/configuration.conf) t
| h
| e
| c
| o
| n
| f
| i
| g
| f
| i
| l
| e

output.

It would be nice, when:

- the default value could be moved into the description column
- the description would begin on a new line and an earlier column
  (e.g. 30-40) when option name/default-value are too long (> 30-40
  chars)

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1528399&group_id=7586

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk