Re: abort vs. assert

2010-03-16 Thread Paolo Bonzini
On Mon, Mar 15, 2010 at 22:36, Bruno Haible wrote: > Hi Jim, > >> You might just as well define and use your own macro, >> >>     #define ASSERT(e) do { if (!(e)) abort (); } while (0) > > Oh yes, this one is perfectly fine with me. But it wouldn't protect you from #define abort __builtin_unreac

Re: abort vs. assert

2010-03-15 Thread Bruno Haible
Hi Jim, > You might just as well define and use your own macro, > > #define ASSERT(e) do { if (!(e)) abort (); } while (0) Oh yes, this one is perfectly fine with me. > you assert a condition rather than testing its negation. Good point. Yes, I too get confused when reading through a bunch

Re: abort vs. assert

2010-03-15 Thread Jim Meyering
Bruno Haible wrote: > Jim Meyering wrote: >> These days, I prefer to use assert(e) over "if (!e) abort();". >> We used to have to avoid using assert due to portability issues, >> but those went away many years ago. > > I disagree. The reason why I never use 'assert(e)' is to make sure > the safety

Re: abort vs. assert

2010-03-15 Thread Bruno Haible
Jim Meyering wrote: > These days, I prefer to use assert(e) over "if (!e) abort();". > We used to have to avoid using assert due to portability issues, > but those went away many years ago. I disagree. The reason why I never use 'assert(e)' is to make sure the safety checks are actually present.