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

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

 



On Fri, 2001-12-07 at 15:23, Bradley D. LaRonde wrote:
> > Okay, so it's a bad example, but.. :)  Maybe Brad has a better one.
> 
> From drivers/net/wireless/heremes.h:
> 
> <snip>
> /* Register access convenience macros */
> #define hermes_read_reg(hw, off) (inw((hw)->iobase + (off)))
> #define hermes_write_reg(hw, off, val) (outw_p((val), (hw)->iobase + (off)))
> That won't compile with the do {...} while(0)s left in io.h.  My patch lets
> hermes.h (and all other io code that I've tested) compile.
> 
> heremes.h compiles as-is on other platforms.  Why should mips snub it for
> some dubious value of do {...} while(0)?
> 

Because using (foo(),bar()) syntax to cram in a compound statement is
just silly and a bad idea IMHO.  The real Right Thing is to fix the
compiler and use inline functions instead of macros in just about all of
these cases. 

But, given as this puts me in the category of wanting to change other
people's code just for the sake of a preferred coding style, I suppose I
have to cede the point.  :)

-Justin



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

  Powered by Linux