1

so I am all finished with pset6; however, I am having a hard time understanding what is going on here:

while (true)
{
    reset();
    if (connected())
    {

//      ..... bunch of other code that doesn't seem like it would be skipped
//      ..... should the continue statement actually have reset the loop.

        if (dprintf(cfd, "HTTP/1.1 200 OK\r\n") < 0)
        {
            continue;
        }
        if (dprintf(cfd, "Connection: close\r\n") < 0)
        {
            continue;
        } 
//      ..... more dprintf calls continue. seemingly consecutive...
    }
}

The above seems to execute one if statement and then 'continue' on to the next if statement without resetting the loop.

I'm confused because I thought continue statements behaved like this:

enter image description here

Could someone please help clarify:

  1. Don't continue statements move on to the next iteration in the containing loop?
  2. If 1) is true, why does it appear as though it is not the case in this situation?

1 Answer 1

1

Ok well... that was quite the oversight... realized immediately after posting the question.

if dprintf is successfull continue never gets called.

which is what should happen.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .