|
From: | red floyd |
Subject: | Re: Own assert() -> Segmentation fault |
Date: | Mon, 06 Nov 2006 15:53:44 GMT |
User-agent: | Thunderbird 1.5.0.7 (Windows/20060909) |
StreamKid wrote:
why is a segmentation fault caused in this simple thing??? and what exactly is this kind of error??? sorry, n00b things :/ ****************************************************** *#define DEBUG *#include <cstdio> * *#define assert( x ) \ * if( ! ( x )) \ * { \ * printf( "\nERROR!! Assert %s failed", #x ); \ * printf( "\n on line %s", __LINE__ ); \ * }
Your error is on the __LINE__ printf. __LINE__ isn't a C style string, its an integral type (the exact flavor escapes me at the moment). %s is the wrong format. This is why, in C++, it is recommended that you avoid printf and friends, and use iostreams instead.
[Prev in Thread] | Current Thread | [Next in Thread] |