Couple of bugs

Steve Grubb sgrubb at
Wed Feb 25 23:44:11 CET 2009

On Wednesday 25 February 2009 04:49:01 pm Brandon Black wrote:
> On Wed, Feb 25, 2009 at 3:19 PM, Marc Lehmann <schmorp at> wrote:
> > You are free to define NDEBUG if you want (this is documented, btw.).
> >
> > There are no known issues with function calls in asserts so far...
> FWIW, I've been using libev embedded in my production application,
> compiled with NDEBUG, for months now without running into any issues.

Thanks...that's good to know. Here is my concern. Let's take this little 

#include <assert.h>
#include <unistd.h>

int main(void)
        assert (("Blah, Blah", access("./test", R_OK)==0));
        return 0;

Now, we strace it with NDEBUG defined and then without. Doing a diff shows:

-munmap(0x7f5f8f3bc000, 136279)          = 0
+munmap(0x7f28d94ed000, 136279)          = 0
+access("./test", R_OK)                  = 0
 exit_group(0)                           = ?

The function call clearly gets swung in and out based on the flag. So, in ev.c 
near the bottom, I find this:

assert (("libev: loop to be embedded is not embeddable", backend & 
ev_embeddable_backends ()));

But this is the one and only function that is being swung in or out as far as 
I can tell. I looked over all asserts carefully and Marc was right, some of 
the things I thought were functions were actually macros.  :)

Marc, Brandon,  Thanks for your help.


More information about the libev mailing list