Giorgos Keramidas <[EMAIL PROTECTED]> writes:
> On 2002-05-11 18:34, Dag-Erling Smorgrav wrote:
> > Hmm, does this mean Duff's Device is not valid C?
> It is ugly.  I'm not sure if it's non-standard too.  My impression
> until now was that jumping from an outter block 'inside' a contained
> block is not a Good Thing(TM).  Note that the switch cases also lack a
> 'break' and are falling through.  All of them!

Yes, this is intentional.

> This makes me wonder that happens the second time the loop runs.  Does
> the code start the second iteration at the beginning of the while
> body?  Or does it start at where the loop was entered the first time
> (the proper 'case' of the switch statement)?

At the top of the loop.

This is a classic, if somewhat obscure, construct, named Duff's Device
after Tom Duff, who devised it as a way of unrolling an I/O loop on a
machine that had memory-mapped I/O.  See the comp.lang.c FAQ for
additional details.

I think the proper way to silence this warning is to move the top of
the while loop into 'case 0'.

Dag-Erling Smorgrav - [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to