[SimGrid-user] Rép : Re: Dynar issues

Christophe ENDERLIN c.enderlin at me.com
Thu Feb 14 15:14:25 CET 2013



Le 13 fév 2013 à 01:03, Martin Quinson <martin.quinson at loria.fr> a écrit :

> > > xbt_dynar_foreach(me->cnx_req_queue, iter, elem) {
> > > if (!memcmp(elem, cnx_elem, sizeof(*cnx_elem))) {
> > > if (test == -1) {
> > > test = iter;
> > > }
> > > }
> > > }
>
>
> In addition, you could break your foreach loop when you find your
> value, there is no need to completely traverse it. Just use the break
> keyword (or return) for that.
>
> Cheers, Mt.

Hi,

Well, I made some tests with this tip and it doesn't seem to work.
If I use the break keyword to interrupt an xbt_dynar_foreach loop, then I'm not able to traverse the dynar once more, it enters into an endless loop.
If I don't use this keyword, then I'm able to run as many xbt_dynar_foreach loops as I want.
It looks like a bug, I think ...

Cheers,

Christophe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/simgrid-user/attachments/20130214/b1a62bf1/attachment.html>


More information about the Simgrid-user mailing list