Skip site navigation (1)Skip section navigation (2)
Date:      12 May 2002 00:06:57 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc:        hiten@uk.FreeBSD.org, current@FreeBSD.org
Subject:   Re: alpha tinderbox failure
Message-ID:  <xzpy9eqwd8e.fsf@flood.ping.uio.no>
In-Reply-To: <20020511213704.GF16174@hades.hell.gr>
References:  <20020511161441.GA1568@hpdi.ath.cx> <xzpy9eqzlqz.fsf@flood.ping.uio.no> <20020511213704.GF16174@hades.hell.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
Giorgos Keramidas <keramida@ceid.upatras.gr> 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'.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpy9eqwd8e.fsf>