#3525 closed Bugs (fixed)
problem with example response_file.cpp
Reported by: | Owned by: | Vladimir Prus | |
---|---|---|---|
Milestone: | Boost 1.42.0 | Component: | program_options |
Version: | Boost 1.40.0 | Severity: | Cosmetic |
Keywords: | Cc: | s.ochsenknecht@… |
Description
The example works as advertised when the provided response file is used. If I modify the response file as follows:
-I bar1234567890123456789012345678901234567890 -I biz --magic=10
then the output is garbled:
Include paths: bar12�\pA5678Abar12
I can fix the problem if I add
string sss= ss.str();
and replace the tokenizer line with
tokenizer<char_separator<char> > tok(sss, sep);
I'm not too sure why the problem occurs, as ss.str() is supposed to return a copy.
I work on Linux, gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3
Attachments (1)
Change History (5)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Cc: | added |
---|
comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 13 years ago
Milestone: | Boost 1.41.0 → Boost 1.42.0 |
---|
Note:
See TracTickets
for help on using tickets.
valgrind shows the errors.
stringstream::str() returns a *copy* of the string. This is a temporary object. The tokenizer does further operations on the string which is descruted already. The string has to live as long as the tokenizer.
So, its not a bug of program_options. I think the testcase has to be adapted. I will attach a patch soon ...