Re: About UT_ASSERT


Subject: Re: About UT_ASSERT
From: Hubert Figuiere (hfiguiere@teaser.fr)
Date: Fri May 04 2001 - 07:40:46 CDT


According to Joaquin Cuenca Abela <cuenca@celium.net>:
> in ie_exp.cpp, line 62, we have:
>
> UT_ASSERT(m_sniffers.addItem (s, &ndx) == UT_OK);
>
> but if we define NDEBUG, UT_ASSERT will expand to nothing, thus in
> production conditions it will be equivalent to:
>
> ;
>
> when I think that it should be equivalent to:
>
> m_sniffers.addItem (s, &ndx);
>
> Am I missing something?
>

UT_ASSERT is #defined as assert in non debug (NDEBUG).
assert is defined as is:
# define assert(expr) ((void) 0)

So expr is discarded at compile time.

The bottom line: the above code is wrong and should be fixed by
moving the function call outside UT_ASSERT.

Hub



This archive was generated by hypermail 2b25 : Sat May 26 2001 - 03:51:02 CDT