Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@oss.sgi.com>
To: Daniel Jacobowitz <dan@debian.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	"Bradley D. LaRonde" <brad@ltc.com>,
	Linux/MIPS Development <linux-mips@oss.sgi.com>
Subject: Re: PATCH: io.h remove detrimental do {...} whiles, add sequence points, add const modifiers
Date: Fri, 7 Dec 2001 16:06:36 -0200	[thread overview]
Message-ID: <20011207160636.B23798@dea.linux-mips.net> (raw)
In-Reply-To: <20011207123833.A23784@nevyn.them.org>; from dan@debian.org on Fri, Dec 07, 2001 at 12:38:33PM -0500

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

  parent reply	other threads:[~2001-12-07 19:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-07 17:14 PATCH: io.h remove detrimental do {...} whiles, add sequence points, add const modifiers Bradley D. LaRonde
2001-12-07 17:30 ` Geert Uytterhoeven
2001-12-07 17:38   ` Daniel Jacobowitz
2001-12-07 18:04     ` Jim Paris
2001-12-07 18:06     ` Ralf Baechle [this message]
2001-12-07 18:15       ` Jim Paris
2001-12-07 19:36         ` Justin Carlson
2001-12-07 19:43           ` Jim Paris
2001-12-07 20:23             ` Bradley D. LaRonde
2001-12-07 20:23               ` Bradley D. LaRonde
2001-12-07 20:44               ` Justin Carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011207160636.B23798@dea.linux-mips.net \
    --to=ralf@oss.sgi.com \
    --cc=brad@ltc.com \
    --cc=dan@debian.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-mips@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox