Monday, October 12, 2009

vector bounds checking in GCC

Robbed from somewhere on the internet. I can't try this is my application because my libraries are not compiled with GLIBCXX_DEBUG but I believe this option should enable bounds checking on stl vectors etc. Here as a note for future use:

Pedantic debug mode checks not only for errors, but also for usages that rely on GNU extensions and that, while correct, may not be portable to other compilers. In pedantic mode, for example, constructing an std::string with a null pointer will result in an abort, not an exception. Pedantic debug mode is not the default. To enable pedantic debug mode, compile your program with both -D_GLIBCXX_DEBUG and -D_GLIBCXX_DEBUG_PEDANTIC.

Robbed from here: http://lists.apple.com/archives/xcode-users/2006/Feb/msg00209.html

No comments: