Simple member thunk for threads
Tuesday, 22. January 2008, 02:35:33
The Royal C++ Embassy
Tuesday, 22. January 2008, 02:35:33
Tuesday, 15. May 2007, 21:46:54
Wednesday, 3. May 2006, 14:55:19
void f(void *p)
{
assert(p); /* ensure p is not NULL */
/* ... */
}
Assertion failed on somesourcefile.c:441
Assertion failed on somesourcefile.c:441 p
void f(void *p)
{
assert(p != NULL); /* ensure p is not NULL */
/* ... */
}
Assertion failed on somesourcefile.c:441 p != NULL
void f(void* p)
{
if (p == NULL)
_assert(TEXT("p is NULL!\r\n"), __FILE__, __LINE__);
}
error: '_assert' undeclared identifier
void f(void* p)
{
if (p == NULL)
_assert(TEXT("p is NULL!\r\n"), __FILE__, __LINE__);
}
#define MyNiceAssert(x) ((!!(x)) || (_asssert(#x, __FILE__, __LINE__)))
void f(void* p)
{
MyNiceAssert(p != NULL);
}
#ifdef _WIN32
// this is my land and don't you break into here
// WARNNOTE (ismailp): __FILE__ is ASCII, try following for UNICODE
// #define WIDEN(x) (L##x)
// #define WFILE (WIDEN(__FILE__))
// #ifdef UNICODE
// #define TFILE WFILE
// #else
// #define TFILE __FILE__
// #endif
// MyAssertReportFunction(TEXT("Message"), TFILE, __LINE__);
void MyAssertReportFunction(LPCTSTR lpszMessage, LPCTSTR lpszFile, UINT uLine)
{
// check input arguments
// calculate buffer space
// I recommend using a static MyAssert stack or heap somewhere else
extern LPTSTR lpszBuffer;
wsprintf(lpszBuffer, TEXT("Program aborted because pre/post ")
TEXT("condition has been violated.\r\n")
TEXT("Message: %s\r\n")
TEXT("File: %s\r\n")
TEXT("Line: %u\r\n"),
lpszMessage, lpszFile, uLine);
OutputDebugString(lpszBuffer);
// free/clean buffer used, if required
DebugBreak(); // preferably, you can call abort() instead
}
#define MYASSERT(x) ((!!(x)) || (MyAssertReportFunction(#x, TFILE, __LINE__)))
void CalcDate(unsigned int uYear, unsigned int uMonth, unsigned int uDay)
{
MYASSERT(uMonth < 13);
/* .. */
/* post condition */
MYASSERT(uMonth < 13);
}
#endif // _WIN32
void CalcDate(unsigned int uYear, unsigned int uMonth, unsigned int uDay)
{
assert(((uMonth < 13) && TEXT("CalcDate: Pre-condition violation; Month is greater than 12.")));
/* .. */
}
Assertion failed on somesourcefile.c:441
uMonth < 13 && TEXT("CalcDate: Pre-condition violation; Month is greater than 12.")
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
| ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | |||||
If you are an aviation enthusiast and want to fly with "human" ATCs "human" pilots, don't miss VATSIM.
You can watch or download various aviation videos.
Pretty big source and library for aviation enthusiast.
Turkish flight simulation portal.
Are you skilled enough to fly with Lufthansa VA? I am!
Source for sim-pilots interested in Turkish airspace or training material.
Navigation Update Service for Flight Simulations. Download latest AIRAC, SID/STARs to your sim.
Source for any kind of C++ question.
Herb Sutter's web site.