Index: options_description.cpp =================================================================== RCS file: /cvsroot/boost/boost/libs/program_options/src/options_description.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -p -r1.16 -r1.17 --- options_description.cpp 9 Jan 2006 09:06:24 -0000 1.16 +++ options_description.cpp 24 Apr 2006 08:00:13 -0000 1.17 @@ -390,13 +390,12 @@ namespace boost { namespace program_opti } } - string::const_iterator line_end; - - line_end = line_begin + line_length; - if (line_end > par_end) - { - line_end = par_end; - } + // Take care to never increment the iterator past + // the end, since MSVC 8.0 (brokenly), assumes that + // doing that, even if no access happens, is a bug. + unsigned remaining = distance(line_begin, par_end); + string::const_iterator line_end = line_begin + + ((remaining < line_length) ? remaining : line_length); // prevent chopped words // Is line_end between two non-space characters?