Subject: Re: Should PR 18434 be closed?
To: Naoto Shimazaki <>
From: David Laight <>
List: tech-kern
Date: 04/07/2003 12:05:49
> It is easy to modify DELAY() to:
> #define DELAY(n)	do {	\
> 		register int N = cpuspeed * (n); while (--N > 0);	\
> 	} while (/*CONSTCONT*/ 0)

Declaring local variables within blocks inside #defines is nasty.

Consider what happens to the call DELAY(N).

If is also not at all clear that the compiler can't optimise out the
the above code.  Actually it is probably ok because the compiler
probably assumes that the loop will be infinite if 'n' or 'cpuspeed'
is -ve.

> I suggest to modify DELAY() like above in all MIPS ports and close this PR.

Kill the 'register' (at best pointless) and change N to __N (or __n).


David Laight: