Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow third-party code to define its own assert definitions #1

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions Detour/Include/DetourAssert.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@
// Note: This header file's only purpose is to include define assert.
// Feel free to change the file and include your own implementation instead.

#include "common/Common.h"
#define dtAssert DAEMON_ASSERT
// Define dtAssert if there is no user-supplied definition.
// Note that if there is a user-supplied definition, it is used even if NDEBUG is defined.
#ifndef dtAssert
# ifdef NDEBUG
// From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
# define dtAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false)
# else
# include <assert.h>
# define dtAssert assert
# endif
#endif // ifndef dtAssert

#endif // DETOURASSERT_H
13 changes: 11 additions & 2 deletions Recast/Include/RecastAssert.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@
// Note: This header file's only purpose is to include define assert.
// Feel free to change the file and include your own implementation instead.

#include "common/Common.h"
#define rcAssert DAEMON_ASSERT
// Define rcAssert if there is no user-supplied definition.
// Note that if there is a user-supplied definition, it is used even if NDEBUG is defined.
#ifndef rcAssert
# ifdef NDEBUG
// From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
# define rcAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false)
# else
# include <assert.h>
# define rcAssert assert
# endif
#endif // ifndef rcAssert

#endif // RECASTASSERT_H