Boost logo

Boost Users :

From: John Maddock (john_maddock_at_[hidden])
Date: 2003-02-13 06:40:54


> I am using boost::regex (1.29.0) under MSVC++ 6.0. Whenever I call
> regex_match(), I get:
>
> "Unhandled exception in filename.exe: 0xC0000094: Integer Divide by
> Zero."
>
> I have tried various ways to make the call (including the snippets posted
> on www.boost.org). Even this simple example fails:
>
> regex expression("abc");
> cmatch what;
> if ( regex_match("xyz", what, expression) )
> {
> // Whatever ...
> }
>
> Breakpoints reveal that after expression is set, the value of
> _expression_len is still 0. So when regex_match() is called, it in turn
> sends the value of expression.size() (which is just _expression_len) to
> re_detail::_priv_match_data(), which sends this value to
> estimate_max_state_count(). Then estimate_max_state_counts(), which calls
> this value "states", does the following:
>
> states *= states;
> // and later ...
> if(dist > (difference_type)(lim / states))
>
> Since states is 0, this last expression causes division by 0, and the
> resulting exception.
>
> In case my environment matters, I am building my program under MSVC++ 6.0,
> running with boost_regex.dll. I am defining BOOST_REGEX_NO_LIB and
> BOOST_REGEX_USE_CPP_LOCALE, and linking in boost_regex.lib.
>
> What am I doing wrong?

I have no idea, but you did build the lib with BOOST_REGEX_USE_CPP_LOCALE
defined didn't you? If you didn't then things will definitely go badly
wrong if you are using that define in your code, but then I would expect you
to not be able to link in that case. Whatever I haven't been able to
reproduce your test case.

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


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