|
Boost Users : |
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-08-09 12:35:31
Hi!
I use MS VC8.0 (2005) Express Edition.
This code sample causes the following assertion:
int main(int argc, char* argv[])
{
options_description generic("Generic options");
generic.add_options()
("version,v", "print version string")
("help,h", "produce help message")
;
// Declare a group of options that will be
// allowed both on command line and in
// config file
options_description config("Configuration");
config.add_options()
("worker-threads,w", po::value<int>()->default_value(20), "Each worker thread starts parsing of
one file.\ndefault: 20")
;
options_description cmdline_opt, cfgf_opt;
cmdline_opt.add(generic).add(config);
cfgf_opt.add(config);
variables_map vm;
store(command_line_parser(argc, argv).options(cmdline_opt).run(), vm);
ifstream ifs("scanning_options.cfg");
store(parse_config_file(ifs, cfgf_opt), vm);
notify(vm);
if(vm.count("help"))
cout << config << endl;
//... some other code
return 0;
}
In this line:
cout << config << endl;
I receive an assertion:
Debug Assertion Failed!
Program: e:\projects\...\protocol_scanner.exe
File: e:\program files\microsoft visual studio 8\vc\include\xstring
Line: 173
Expression: ("_Myptr + _Off <= (((_Mystring *)this->_Mycont)->_Myptr() + ((_Mystring
*)this->_Mycont)->_Mysize) && _Myptr + _Off >= ((_Mystring*)this->_Mycont)->_Myptr()",0)
...
line 173 is part of a function in xstring
_Myt& __CLR_OR_THIS_CALL operator+=(difference_type _Off)
{ // increment by integer
if (this->_Mycont != _IGNORE_MYCONT)
{
_SCL_SECURE_VALIDATE(this->_Mycont != NULL);
_SCL_SECURE_VALIDATE_RANGE(
_Myptr + _Off <= (((_Mystring *)this->_Mycont)->_Myptr() + ((_Mystring
*)this->_Mycont)->_Mysize) &&
_Myptr + _Off >= ((_Mystring *)this->_Mycont)->_Myptr()); // <- line 173
}
_Myptr += _Off;
return (*this);
}
Output in stdout window looks like:
Generic options:
-v [ --version ] print version string
-h [ --help ] produce help message
Configuration:
-w [ --worker-threads ] arg (=20)
-------------------------^^^^^^^^^^ this looks really weired!!! Here should be another message.
Last line is really weired...
Stack trace is:
> protocol_scanner.exe!std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>
>::operator+=(int _Off=-1) Line 171 + 0x78 bytes C++
protocol_scanner.exe!std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>
>::operator-=(int _Off=1) Line 188 C++
protocol_scanner.exe!std::_String_const_iterator<char,std::char_traits<char>,std::allocator<char>
>::operator-(int _Off=1) Line 193 + 0xc bytes C++
protocol_scanner.exe!boost::program_options::`anonymous
namespace'::format_paragraph(std::basic_ostream<char,std::char_traits<char> > & os={...},
std::basic_string<char,std::char_traits<char>,std::allocator<char> > par="Each worker thread
starts parsing of one file.", unsigned int first_column_width=36, unsigned int line_length=79)
Line 381 + 0x28 bytes C++
protocol_scanner.exe!boost::program_options::`anonymous
namespace'::format_description(std::basic_ostream<char,std::char_traits<char> > & os={...}, const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > & desc="Each worker thread
starts parsing of one file.\ndefault: 20", unsigned int first_column_width=36, unsigned int
line_length=79) Line 453 + 0x34 bytes C++
protocol_scanner.exe!boost::program_options::`anonymous
namespace'::format_one(std::basic_ostream<char,std::char_traits<char> > & os={...}, const
boost::program_options::option_description & opt={...}, unsigned int first_column_width=36,
unsigned int line_length=80) Line 489 + 0x1a bytes C++
protocol_scanner.exe!boost::program_options::options_description::print(std::basic_ostream<char,std::char_traits<char>
> & os={...}) Line 522 + 0x1e bytes C++
protocol_scanner.exe!boost::program_options::operator<<(std::basic_ostream<char,std::char_traits<char>
> & os={...}, const boost::program_options::options_description & desc={...}) Line 289 C++
protocol_scanner.exe!boost::program_options::options_description::print(std::basic_ostream<char,std::char_traits<char>
> & os={...}) Line 528 + 0x34 bytes C++
protocol_scanner.exe!boost::program_options::operator<<(std::basic_ostream<char,std::char_traits<char>
> & os={...}, const boost::program_options::options_description & desc={...}) Line 289 C++
protocol_scanner.exe!main(int argc=2, char * * argv=0x00353980) Line 128 + 0x13 bytes C++
Parameter of executable is:
--help
With Kind Regards,
Ovanes Markarian
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net