Skip to content

Instantly share code, notes, and snippets.

@mwbrooks
Created March 29, 2010 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwbrooks/348509 to your computer and use it in GitHub Desktop.
Save mwbrooks/348509 to your computer and use it in GitHub Desktop.
// Uncomment to disable assertions.
// NDEBUG macro must be defined before #include <assert.h>
// #define NDEBUG
#include <assert.h>
int main (int argc, char * const argv[]) {
int *goodInteger = new int(2);
int *badInteger = NULL;
assert(true); // pass
assert(false); // fail
assert(goodInteger); // pass
assert(badInteger); // fail
delete goodInteger;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment