Date: Wed, 2 Jan 2002 10:52:44 -0500 From: Garance A Drosihn <drosih@rpi.edu> To: Stephen McKay <mckay@thehub.com.au>, Julian Elischer <julian@elischer.org> Cc: John Baldwin <jhb@FreeBSD.org>, Poul-Henning Kamp <phk@critter.freebsd.dk>, cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Julian Elischer <julian@FreeBSD.org>, Greg Lehey <grog@FreeBSD.org>, mckay@thehub.com.au Subject: Re: cvs commit: src/share/man/man3 queue.3 Message-ID: <p05101000b858dc1a097e@[128.113.24.47]> In-Reply-To: <200201021440.g02Eess11512@dungeon.home> References: <20011231165233.A408@dhcp01.pn.xcllnt.net> <Pine.BSF.4.21.0112311706450.10883-100000@InterJet.elischer.org> <200201021440.g02Eess11512@dungeon.home>
next in thread | previous in thread | raw e-mail | index | archive | help
At 12:40 AM +1000 1/3/02, Stephen McKay wrote: >On Tuesday, 1st January 2002, Julian Elischer wrote: > > I'm just documenting what the code does, and how people have used it. > > if you think that phk is correct we should add an example to the man > > page showing: > >Perhaps Marcel's good example instead: > >> TAILQ_FOREACH(p, &list, p_next) { >> if (some_test_on(p)) { >> /* Do something */ >> break; /* optional */ >> } >> } > >The man page should explicitly state that p is undefined after the loop >completes unless the user breaks out. Oh, and explicitly stating that >it is OK to break out at all might be nice too. :-) Perhaps I am missing something, but this issue seems pretty simple to me. What's wrong with: keyp = NULL; TAILQ_FOREACH(p, &list, p_next) { if (some_test_on(p)) { keyp = p; break; /* optional */ } } and then using 'keyp' outside the loop? -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05101000b858dc1a097e>