Hi
I fooled around with the debugger a little, and it looks like
program_options decrements a string iterator that already points at
the beginning of a string.
string::const_iterator last_space =
find(reverse_iteratorstring::const_iterator(line_end - 1),
reverse_iteratorstring::const_iterator(line_begin - 1), ' ').base();
I'm assuming that this is the error (I haven't had a chance to look at
CVS yet). I'm no language lawyer, but I would think that such behavior
is undefined. Why is it unreasonable for VC++2005 to test for it?
I'm not an expert Boost user, and I need a stable version. Should I
just change (line - 1) to (line)+1 ?
On 2/23/07, Vladimir Prus
n.torrey.pines wrote:
In VC++2005 debug mode (Ctrl-F5), this little program aborts:
+++++++++++++ begin ++++++++++++++++++++++++ #include <iostream> #include
int main(int argc, char * argv[]) { boost::program_options::options_description desc("Allowed options"); desc.add_options() ("some_option", "\ This option description SHOULD be long enough not to fit in one line"); std::cout << desc << '\n'; } ++++++++++++ end +++++++++++++++++++++++++++
The debug assertion failure message is:
File: C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\xstring Line: 173
Through multiple trials, I found that the error occurs if and only if the option description is long enough not to fit in one line in the window.
This is boost-1_33_1
Since I have no prior experience with program_options, perhaps I'm using it incorrectly?
This is a combination of somewhat sloppy code in the formatting code, and somewhat unreasonable runtime checking in VC++2005. This is supposed to be fixed in CVS, can you try it?
- Volodya
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users