From: Harvey Harrison <harvey.harrison@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Jeff Garzik <jeff@garzik.org>,
linux-ide <linux-ide@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 5/11v2] ata: replace macro with static inline in libata.h
Date: Fri, 15 Feb 2008 16:23:11 -0800 [thread overview]
Message-ID: <1203121391.7442.6.camel@brick> (raw)
In-Reply-To: <20080216000557.6f6e9588@core>
On Sat, 2008-02-16 at 00:05 +0000, Alan Cox wrote:
> On Fri, 15 Feb 2008 15:08:50 -0800
> Harvey Harrison <harvey.harrison@gmail.com> wrote:
>
> > On Fri, 2008-02-15 at 22:53 +0000, Alan Cox wrote:
> > > > > NAK. This is a sparse bug, fix sparse.
> > > >
> > > > Yes, fair enough, but that's not all the patch is about.
> > > >
> > > > 1) it's using a max_t and min_t to force the comparisons as shorts, why
> > > > not just make it a static inline?
> > >
> > > Because max_t and min_t also force the comparsion types
> >
> > Umm, maybe I'm missing something then, but how does the static inline
> > not do this?
>
> You claimed it was an advantage of the static inline earlier but both do
> anyway
Oh, I thought I said it accomplished the _same_ typechecking, my bad.
>
> > OK, maybe not much clearer. But isn't the inline easier to see at
> > a glance that it is returning a value constrained to be
> >
> > vmin <= v <= vmax
> >
> > I suppose the variable names make it clear, but the macro construction
> > is (slightly) less obvious.
>
> Perhaps then clamp_t()
>
> > __mint __maxt...but I'm not proposing that.
>
> I am - as I bet there are other examples of that construct in the tree.
Lots, but form what I've seen, most could use a helper inline that is a
lot cleaner than what is currently there. This case is about the same
either way.
>
> > > gcc still sometimes seems to optimise macros better than inlines.
> >
> > OK, I didn't realize that, any pointers?
>
> Not offhand, there is discussion in the archives but it may be somewhat
> out of date for the latest gcc.
>
> I'm not arguing your change is -wrong- I just think the original is
> tidier and clearer. Its up to Jeff anyway
Fair enough. This change would make sparse a whole lot more useful
for libata, as it's down to 6 warnings with this and my 3/3 patch
removing another min/max nesting. Going forward this would probably
make it easier on the maintainer to script up some automated checking.
Cheers,
Harvey
next prev parent reply other threads:[~2008-02-16 0:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-15 22:06 [PATCH 5/11v2] ata: replace macro with static inline in libata.h Harvey Harrison
2008-02-15 22:30 ` Alan Cox
2008-02-15 22:46 ` Harvey Harrison
2008-02-15 22:53 ` Alan Cox
2008-02-15 23:08 ` Harvey Harrison
2008-02-16 0:05 ` Alan Cox
2008-02-16 0:23 ` Harvey Harrison [this message]
2008-02-16 0:36 ` Harvey Harrison
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=1203121391.7442.6.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).