boost::regex behaving differently on debug and release builds
boost::regex re("^\\s*([_\\w\\.]+)\\s*=\\s*([^\\s]+)$");
if(re.empty()){
std::cout<<"How is this possible?"<<std::endl;
}
That line prints in my release builds! (The debug builds are fine) Working with MSVC 2008 (vc 9.0)
Compiler options for DEBUG:
/Od /I "C:\Program Files\boost\boost_1_44_0" /I "C:\gtest-1.5.0\include" /I "include" /I "include\EMP" /I "dependencies\EMP\include" /I "dependencies\APR\apr-1.3.3\include" /I "dependencies\solclient_5.0.0.22\include" /I "dependencies\SS66\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "EMP_WIN_X86_32" /D "_iso_stdcpp_" /D "_CRT_SECURE_NO_DEPRECATE" /D "_SECURE_SCL=0" /D "_EMPAPI_STATIC_BUILD" /D "_EMPAPI_STATIC_LINK" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /fp:fast /Fo"Debug\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt
Compiler options for RELEASE:
/O2 /Oi /GL /I "C:\Program Files\boost\boost_1_44_0" /I "C:\gtest-1.5.0\include" /I "include" /I "include\EMP" /I "dependencies\EMP\include" /I "dependencies\APR\apr-1.3.3\include" /I "dependencies\solclient_5.0.0.22\include" /I "dependencies\SS66\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "EMP_WIN_X86_32" /D "_iso_stdcpp_" /D "_CRT_SECURE_NO_DEPRECATE" /D "_SECURE_SCL=0" /D "_EMPAPI_STATIC_BUILD" /D "_EMPAPI_STATIC_LINK" /D "_UNICODE" /D "UNICODE" /FD /EHsc /MD /Gy /fp:fast /Fo"Release\" /Fd"Release\vc90.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt
Linker Options for DEBUG:
/OUT:"C:\WorkFlow\cpp_client_library\Debug\cpp_client_library.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\WorkFlow\cpp_client_library\workflow_client_cpp\dependencies\APR\apr-1.3.3\Release" /LIBPATH:"C:\WorkFlow\cpp_client_library\workflow_client_cpp\dependencies\EMP\lib\win32_vc80" /LIBPATH:"C:\WorkFlow\cpp_client_library\workflow_client_cpp\dependencies\solclient_5.0.0.22\lib" /LIBPATH:"C:\WorkFlow\cpp_client_library\workflow_client_cpp\dependencies\SS66\lib\i86_w32" /LIBPATH:"C:\Program Files\boost\boost_1_44_0\stage\lib" /LIBPATH:"C:\gtest-1.5.0\msvc\gtest\Debug" /MANIFEST /MANIFESTFILE:"Debug\cpp_client_library.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"c:\WorkFlow\cpp_client_library\Debug\cpp_client_library.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT emp.lib libsolclient.lib tipc.lib tutil.lib gtestd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
Linker Options for RELEASE:
/OUT:"C:\WorkFlow\cpp_client_library\Release\cpp_client_library.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\WorkFlow\cpp_client_library\workflow_client_cpp\dependencies\APR\apr-1.3.3\Release" /LIBPATH:"C:\WorkFlow\cpp_client_library\workflow_client_cpp\dependencies\EMP\lib\win32_vc80" /LIBPATH:"C:\WorkFlow\cpp_client_library\workflow_client_cpp\dependencies\solclient_5.0.0.22\lib" /LIBPATH:"C:\WorkFlow\cpp_client_library\workflow_client_cpp\dependencies\SS66\lib\i86_w32" /LIBPATH:"C:\Program Files\boost\boost_1_44_0\stage\lib" /LIBPATH:"C:\gtest-1.5.0\msvc\gtest\Release" /MANIFEST /MANIFESTFILE:"Release\cpp_client_library.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"c:\WorkFlow\cpp_client_library\Release\cpp_client_library.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT /MACHINE:X86开发者_JAVA技巧 /ERRORREPORT:PROMPT emp.lib libsolclient.lib tipc.lib tutil.lib gtest.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
I moved to using visual studio 2005 and the problem went away but I am now getting an exception near the end of the application:
Unhandled exception at 0x0042d935 in myApp.exe: 0xC0000005: Access violation reading location 0xe06d7390.
The call stack is
kernel32.dll!7c812afb()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
kernel32.dll!7c812afb()
msvcp80.dll!7c421201()
msvcp80.dll!7c42394d()
msvcp80.dll!7c423958()
msvcr80.dll!78158e89()
myApp.exe!std::_Tree,std::allocator >,std::less,std::allocator,std::allocator > > >,0> >::erase(std::_Tree,std::allocator >,std::less,std::allocator,std::allocator > > >,0> >::iterator _Where={...}) Line 759
msvcr80.dll!78134c39()
myApp.exe!std::_Tree,std::allocator >,std::less,std::allocator,std::allocator > > >,0> >::erase(std::_Tree,std::allocator >,std::less,std::allocator,std::allocator > > >,0> >::iterator _First={...}, std::_Tree,std::allocator >,std::less,std::allocator,std::allocator > > >,0> >::iterator _Last={...}) Line 926 + 0x4f bytes
myApp.exe!boost::re_detail::w32_regex_traits_implementation::~w32_regex_traits_implementation() + 0xc0 bytes
myApp.exe!boost::detail::sp_counted_impl_p >::dispose() + 0xf bytes
myApp.exe!std::list const >,unsigned long const *>,std::allocator const >,unsigned long const *> > >::clear() + 0x3e bytes
myApp.exe!boost::object_cache >::data::~data() + 0x6b bytes
msvcr80.dll!781319d8()
msvcr80.dll!78131a4b()
myApp.exe!__tmainCRTStartup() Line 603
kernel32.dll!7c817077()
精彩评论