Leopold Toetsch wrote:
Am Dienstag, 11. März 2008 20:43 schrieb Ron Blaschke:
void
Parrot_assert(INTVAL condition, ARGIN(const char *condition_string),
         ARGIN(const char *file), unsigned int line)
...

PARROT_ASSERT is used to assert pointers too, for example in src/string.c:

What about making Parrot_assert a macro too, or probably simpler fixing PARROT_ASSERT for the ! NDEBUG case:

#define PARROT_ASSERT(x) \
  do { \
    if (!x) \
          Parrot_confess(#x, __FILE__, __LINE__) \
  } \
  while (0)

- untested - just an idea.

leo

I like it, but I'd rather have you guys make the call.

I'm bringing this up because VC++ has the option to check if a cast looses information (C<-RTCc> Convert to smaller type checks), which I hope to help me with getting Parrot working on Windows x64.

I've just looked up how C's assert is implemented in two libraries.

glibc 2.7

# define assert(expr)  \
  ((expr)  \
   ? __ASSERT_VOID_CAST (0)  \
   : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION))


Windows SDK 6.0

#define assert(_Expression) (void)( (!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression), _CRT_WIDE(__FILE__), __LINE__), 0) )

Ron

Reply via email to