On my implementation of C++ (Visual Studio 2008 implementation) I see the following line in <cassert>
#ifdef NDEBUG
#define assert(_Expression) ((void)0)
I do not understand the need to cast 0 to void. It seems to me that
#ifdef NDEBUG
#define assert(_Expression) (0)
or even simply
#ifdef NDEBUG
#define assert(_Expression) 0
would do, considering the contexts in which assert(expr) can be used.
So, what's the danger of 0 of type int instead of 0 of type void in this case? Any realistic examples?