Linux NFS development
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Rick Macklem <rick@snowhite.cis.uoguelph.ca>
Cc: Trond.Myklebust@netapp.com, linux-nfs@vger.kernel.org,
	NFSv4@linux-nfs.org
Subject: Re: [PATCH] nfs: parenthesize NFS_*(inode) parameters
Date: Tue, 22 Jan 2008 18:53:18 +0200	[thread overview]
Message-ID: <47961F7E.8060207@panasas.com> (raw)
In-Reply-To: <200801221606.LAA15590@snowhite.cis.uoguelph.ca>

On Jan. 22, 2008, 18:06 +0200, Rick Macklem <rick@snowhite.cis.uoguelph.ca> wrote:
>>> They should really be converted into inlined functions.
>>>
>>> Cheers
>>>   Trond
>> Agreed.  How about the following:
> 
> Ok, you've tickled my curiosity...why? Unless a macro is large and is
> used many times (my really old nfs code was like that, being written
> for a compiler that didn't support inline functions), what is the
> advantage of inline functions? Or is it just that the code is more readable?

Let me quote Jeff Garzik in http://lwn.net/2000/1123/a/Linus-HOWTO.php3:

	3) 'static inline' is better than a macro

	Static inline functions are greatly preferred over macros.
	They provide type safety, have no length limitations, no formatting
	limitations, and under gcc they are as cheap as macros.

	Macros should only be used for cases where a static inline is clearly
	suboptimal [there a few, isolated cases of this in fast paths],
	or where it is impossible to use a static inline function [such as
	string-izing].

So for zero cost in performance you get safer, scope isolated, and more readable
code.

Benny

> 
> Just curious, I don't have any problem with using inline functions, rick

  reply	other threads:[~2008-01-22 16:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-22 16:06 [PATCH] nfs: parenthesize NFS_*(inode) parameters Rick Macklem
2008-01-22 16:53 ` Benny Halevy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-01-22 14:28 Benny Halevy
2008-01-22 14:50 ` Trond Myklebust
     [not found]   ` <1201013438.30335.5.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-22 15:37     ` Benny Halevy
2008-01-22 16:58       ` Chuck Lever
2008-01-22 18:10         ` Trond Myklebust
2008-01-22 18:30           ` Benny Halevy
2008-01-22 18:58             ` Trond Myklebust

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=47961F7E.8060207@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=NFSv4@linux-nfs.org \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=rick@snowhite.cis.uoguelph.ca \
    /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