[ovs-dev] [ovs-assert 1/4] util: Introduce ovs_assert macro.

Ben Pfaff blp at nicira.com
Thu Jan 10 21:26:52 UTC 2013


On Thu, Jan 10, 2013 at 12:55:09PM -0800, Ethan Jackson wrote:
> Out of curiosity, did you consider the name xassert() as an alternative to
> ovs_assert()?  It has the advantage of following our established convention.

I was taking the "x" prefix to indicate a function wrapper that aborts
on error instead of reporting the error.  Since assert() already
aborts on error, it doesn't really follow the pattern.

> +    static int reentry;
> >
> 
> I'm not sure if the C spec strictly requires it, but I would feel more
> comfortable if we initialized this to 0 explicitly.

OK, I'll do that.  (It isn't strictly required.)

> > +    switch (reentry++) {
> > +    case 0:
> > +        VLOG_ABORT("%s: assertion %s failed in %s()",
> > +                   where, condition, function);
> > +        /* not reached */
> >
> Minor style bit I may go ahead and make this an abort() for clarity.  I.E.
>     ovs_abort(); /* not reached */

I'd be more comfortable with a plain abort(), if that's OK.

> Acked-by: Ethan Jackson <ethan at nicira.com>

Thanks.



More information about the dev mailing list