This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: telling GCC that a pointer cannot be NULL


On 10 May 2011 16:42, Ian Lance Taylor <iant@google.com> wrote:
> As of gcc 4.5 you can do this using __builtin_unreachable.

Thanks, this is what I was looking for!

> Use this with care. ÂIf you get it wrong, the results will be wholly
> unpredictable.

I guess enough care could be archived using an assert like in:

#ifdef NDEBUG
#define optimization_assert(cond) do { if (!(cond))
__builtin_unreachable(); } while (0);
#else
#define optimization_assert(cond) assert(cond)
#endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]