-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Profiling indicates that include of iostream is a performance issue
- Loading branch information
Showing
1 changed file
with
10 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,14 @@ | ||
|
||
#pragma once | ||
|
||
#include <cstdlib> | ||
#include <iostream> | ||
|
||
#define CAF_ASSERT( expr ) \ | ||
do \ | ||
{ \ | ||
if ( !( expr ) ) /* NOLINT */ \ | ||
{ \ | ||
std::cout << __FILE__ << ":" << __LINE__ << ": CAF_ASSERT(" << #expr << ") failed" << std::endl; \ | ||
std::abort(); \ | ||
} \ | ||
} while ( false ) | ||
|
||
#if 0 // Bits and pieces for reference to improve the assert | ||
#ifdef _MSC_VER | ||
#pragma warning( push ) | ||
#pragma warning( disable : 4668 ) | ||
#include <windows.h> | ||
#pragma warning( pop ) | ||
#endif | ||
|
||
|
||
void openDebugWindow() | ||
{ | ||
#ifdef _MSC_VER | ||
#pragma warning( push ) | ||
#pragma warning( disable : 4996 ) | ||
AllocConsole(); | ||
freopen("conin$", "r", stdin); | ||
freopen("conout$", "w", stdout); | ||
freopen("conout$", "w", stderr); | ||
#pragma warning( pop ) | ||
#endif | ||
} | ||
|
||
void assertAbort() | ||
{ | ||
#ifdef _MSC_VER | ||
#if ( _MSC_VER >= 1600 ) | ||
//if (::IsDebuggerPresent()) | ||
#endif | ||
{ | ||
__debugbreak(); | ||
} | ||
#endif | ||
|
||
std::terminate(); | ||
} | ||
|
||
#define ASSERT_TEST( expr ) \ | ||
do \ | ||
{ \ | ||
if ( !( expr ) ) \ | ||
{ \ | ||
std::cout << __FILE__ << ":" << __LINE__ << ": CAF_ASSERT(" << #expr << ") failed" << std::endl; \ | ||
assertAbort(); \ | ||
} \ | ||
#include <cstdio> | ||
|
||
#define CAF_ASSERT( expr ) \ | ||
do \ | ||
{ \ | ||
if ( !( expr ) ) /* NOLINT */ \ | ||
{ \ | ||
std::printf( "%s : %i : CAF_ASSERT( %s ) failed\n", __FILE__, __LINE__, #expr ); \ | ||
std::abort(); \ | ||
} \ | ||
} while ( false ) | ||
#endif |