c++ - Check STL bounds in Debug and Release with MinGW -


i'm working on project (settlers 2.5 return roots namely) suffers problems. hope able solve of them using stl containers , bounds checking.

so somehow possible use bounds-checking in stl containers in release mode? use (less performing) version, them , crashes/throws on error?

the build server uses mingw crosscompile linux windows , apple.

edit: []-operator used exclusively. changing .at() require large search-and-replace action got reversed @ point. best be, if there define or switches []-behaviour .at()

first approach

you can rely on exceptions verify bound checking using stl container. enable in both debug , release mode.

for instance std::vector::at throws out of range exception if beyond bounds.

second approach

if use operator[] , not want change code, can enable _glibcxx_debug flag bound checking.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -