This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: sbitmap cleanups
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Subject: Re: sbitmap cleanups
- From: grahams <grahams at rcp dot co dot uk>
- Date: Mon, 10 Apr 2000 19:53:20 +0100
- CC: john_w_marshall at palm dot com, gcc-patches at gcc dot gnu dot org
- References: <10004101843.AA29403@vlsi1.ultra.nyu.edu>
Richard
Richard Kenner wrote:
>
> > ! for (ap = a->elms, bp = b->elms, i = 0; i < a->size; i++)
> > ! if ((*ap++ | *bp++) != *bp)
> > ! return 0;
>
> Uh, I didn't notice any sequence points... you could just put the
> increments up beside the `i++'.
>
> Sure, but it's usually more idiomatic to do it at the reference like that.
The result of evaluating ((*ap++ | *bp++) != *bp) is not well defined.
It can be evaluated may different ways all equally valid. The problem is the
use of *bp++ and *bp in the same expression without an intervening sequence
point.
Perhaps it should be written as follows which matches the style of many of
the other routines.
for (ap = a->elms, bp = b->elms, i = 0; i < a->size; i++)
{
SBITMAP_ELT_TYPE tmp = *bp;
if ((*ap++ | *bp++) != tmp)
return 0;
}
Graham