assert in C or C++ code is an excellent method to ensure correctness of pre-conditions and post-conditions in functions. Assertions are enabled by default in code compiled with GCC C and C++ compilers.
To disable assert,
NDEBUG must be defined. You can choose to define this in your code as
#define NDEBUG. Or you can pass
-DNDEBUG to the GCC compiler while compiling the code.
If you use CMake, you can add it to
CMakeLists.txt like this:
Tried with: CMake 184.108.40.206, GCC 4.9.2 and Ubuntu 14.04