help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Own assert() -> Segmentation fault


From: StreamKid
Subject: Re: Own assert() -> Segmentation fault
Date: 6 Nov 2006 11:28:27 -0800
User-agent: G2/1.0

red floyd wrote:
> 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.



i tried with std::cout. worked :D
thanx very much :)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]