From owner-freebsd-current Sat May 11 14:53:32 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by hub.freebsd.org (Postfix) with ESMTP id 6EEBE37B41A for ; Sat, 11 May 2002 14:52:55 -0700 (PDT) Received: from hades.hell.gr (patr530-b185.otenet.gr [212.205.244.193]) by mailsrv.otenet.gr (8.12.3/8.12.3) with ESMTP id g4BLqgG1003516; Sun, 12 May 2002 00:52:44 +0300 (EEST) Received: from hades.hell.gr (hades [127.0.0.1]) by hades.hell.gr (8.12.3/8.12.3) with ESMTP id g4BLqXKo016930; Sun, 12 May 2002 00:52:41 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from charon@localhost) by hades.hell.gr (8.12.3/8.12.2/Submit) id g4BLb6SN016695; Sun, 12 May 2002 00:37:06 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Sun, 12 May 2002 00:37:05 +0300 From: Giorgos Keramidas To: Dag-Erling Smorgrav Cc: hiten@uk.FreeBSD.org, current@FreeBSD.org Subject: Re: alpha tinderbox failure Message-ID: <20020511213704.GF16174@hades.hell.gr> References: <20020511161441.GA1568@hpdi.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-05-11 18:34, Dag-Erling Smorgrav wrote: > Hiten Pandya writes: > > /* > > * A comment is probably needed here for those not > > * well versed in the "C" language. Yes, this is > > * supposed to be a "switch" with the body of the > > * "switch" being a "while" statement. The whole > > * purpose of the switch is to allow us to jump into > > * the middle of the while() loop, and then not have > > * to do any more switch()s. > > * > > * Some compilers will spit out a warning message > > * about the loop not being entered at the top. > > */ > > switch (n&03) > > while (n > 0) { > > case 0: > > ck ^= (int)*d++ << 24; > > --n; > > case 3: > > ck ^= (int)*d++ << 16; > > --n; > > case 2: > > ck ^= (int)*d++ << 8; > > --n; > > case 1: > > ck ^= (int)*d++; > > --n; > > } > > return(ck); > > 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! 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)? - Giorgos To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message