Sign in to follow this  

release only bug?

This topic is 3574 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

okay im upgrading my project from vc2005 to vc2008 and my app works fine in debug mode, but now in release mode i get a crash. i've tracked it down to some code like this:
cmatch match;
	regex expression("\\(([^\\)]*)\\)");
	char* line = "[game]";
	if (regex_search(line, match, expression))
	{
...


the crash is in 'regex_search' now the weird thing is, i copied this code in to the main project, and it worked, but still continues to crash in this code that is in a seperate project (which compiles to a lib). any thoughts? the call stack ends up in: _invalid_parameter_noinfo called from from boost::match_results by the way my boost libs were compiled in vc2005

Share this post


Link to post
Share on other sites
Boost is "untested" on vc2008. You should be getting compiler warning about it. I've had no problems, but I don't use boost::regex.

This doesn't look like a "crash," but rather an unchecked exception. Use the stack trace to find which function threw the exception and look at the documentation (or if you're brave enough, the source code) for that function and find out why it threw it.

Share this post


Link to post
Share on other sites
The difference is assigning a string literal to a char* will assign the address of the literal in a string table, while assigning it to a char[] will copy the string from the table to an array on the stack. Apparently you're able to write to strings in the string table in debug mode, but not release mode? I know you're not able to write to the string table at all on Linux/GCC, not sure about MSVC.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zahlman
Why would a regex_search write to the searched string, though? o_O


You're right, I spoke too soon. The problem lies elsewhere. regex_search() takes a const char * as the first parameter.

Share this post


Link to post
Share on other sites

This topic is 3574 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this