Re: PATCH: io.h remove detrimental do {...} whiles, add sequence points, add const modifiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 07, 2001 at 12:38:33PM -0500, Daniel Jacobowitz wrote:

> > > -	do { * (unsigned long *) &mips_io_port_base = (base); } while (0)
> > > +	*(unsigned long *)&mips_io_port_base = (base);
> > 
> > Now consider someone writing
> > 
> >     if (...)
> > 	set_io_port_base(...);
> >     else
> > 	...
> > 
> > And see what happens...
> 
> If Bradley loses the extra semicolon, what other problem is the
> do/while construct supposed to address?  I seem to recall there being
> another problem case, but I can't remember what it is.

There is imho not very much sense in such a macro / function being written
in a way that returns any value, that is something like

  foo = set_io_port_base(...)

doesn't make obvious sense.  So it's written in a way which will take care
of any attempt to use the return type.

  Ralf

[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux