Boost logo

Boost Users :

From: Glover Barker (gbarker_at_[hidden])
Date: 2003-02-12 16:36:16


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?

Glover Barker


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