in reply to Re: Re: block-based programming...
in thread block-based programming...

And you think that's more clear? For the sake of removing a goto, you introduce a while, which you, except for one specific case, aren't using as a while at all. Your condition suggests you'll keep trying until close() returns a non-negative value - however, what the code really is doing is retrying only if there's an interrupt. I strongly disagree that your while loop is more clear than a goto. Bending your code backwards to avoid using a goto isn't a good way of programming.

Abigail

Replies are listed 'Best First'.
Re: Re: block-based programming...
by flyingmoose (Priest) on Apr 22, 2004 at 16:42 UTC
    bending a loop backwards ... isn't a good way of programming

    To me, it looks like you are bending an if backwards to create a loop. A while loop with a single iteration under most conditions is perfectly valid, a loop can even execute 0 times. Still valid. To me, the only number that matters is 'n', and n can take on any value, it doesn't matter. But I seriously doubt we will ever come to agreement on this (fair enough)... So I'll give up here.

    IMHO, using a goto to forge a loop isn't a good way of programming. Depends if you pray at the alter of Dijkstra (see link already posted below) or Knuth, I guess. If you have a online reference to the Knuth article, I'd like to read it to see how he justifies the theory. I'm not going to buy K&R or bother reading all of that MIX stuff, so please don't suggest that :)