for (pp=PartHeadp->pt_forw; pp != PartHeadp;

Alex Kid
  • Alex Kid

    Alex Kid - 2008-09-30

    Hi everybody ,

    Just want to know how "to get out of"  for (pp=PartHeadp->pt_forw; pp != PartHeadp; pp = pp->pt_forw)

    pp= PartHeadp; doesn't work .

    Sorry for my english.


    • Sean Morrison

      Sean Morrison - 2008-09-30


      Where'd you get the struct partition from?  Testing for pp != PartHeadp is sufficient on a ray-trace partition hit callback.  If that's not working, you probably have a mistake somewhere else.

      (note you said pp= PartHeadp which is an assignment that will always be true)

      "man librt" or "brlman librt" has an example of a hit callback that iterates over the partitions (although it's old, see raytrace.h for the current callback signature).


    • Timothy Van Ruitenbeek

      If you are trying to exit the for loop early, setting "pp = PartHeadp" inside the loop won't work because the increment part of the for loop will execute before the test.  That means "pp = pp->pt_forw" will be executed before the test "pp != PartHeadp".

      If you don't have nested loops, using "break" should work for you instead of "pp = PartHeadp"


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks