| To: | "Bradley D. LaRonde" <brad@ltc.com> |
|---|---|
| Subject: | Re: PATCH: io.h remove detrimental do {...} whiles, add sequence points, add const modifiers |
| From: | Justin Carlson <justinca@ri.cmu.edu> |
| Date: | 07 Dec 2001 15:44:15 -0500 |
| Cc: | linux-mips@oss.sgi.com |
| In-reply-to: | <01b801c17f5d$0af02180$5601010a@prefect> |
| References: | <20011207121416.A9583@dev1.ltc.com> <Pine.GSO.4.21.0112071830000.29896-100000@mullein.sonytel.be> <20011207123833.A23784@nevyn.them.org> <20011207160636.B23798@dea.linux-mips.net> <20011207131521.A3942@neurosis.mit.edu> <1007753789.1680.1.camel@GLOVEBOX.AHS.RI.CMU.EDU> <20011207144343.A4417@neurosis.mit.edu> <01b801c17f5d$0af02180$5601010a@prefect> |
| Sender: | owner-linux-mips@oss.sgi.com |
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
|
| Previous by Date: | Re: PATCH: io.h remove detrimental do {...} whiles, add sequence points, add const modifiers, Bradley D. LaRonde |
|---|---|
| Next by Date: | Where can I find the source code and binaries of SNMP client and server?, Steven Liu |
| Previous by Thread: | Re: PATCH: io.h remove detrimental do {...} whiles, add sequence points, add const modifiers, Bradley D. LaRonde |
| Next by Thread: | .section problems in entry.S, Kip Walker |
| Indexes: | [Date] [Thread] [Top] [All Lists] |