mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjanv@infradead.org>
To: andyliu <liudeyan@gmail.com>
Cc: Adrian Bunk <bunk@stusta.de>, linux-kernel@vger.kernel.org
Subject: Re: [2.6 patch] loop.c: make two functions static
Date: Sun, 23 Jan 2005 12:03:50 +0100	[thread overview]
Message-ID: <1106478230.6129.10.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <aad1205e050123023214c4fa5c@mail.gmail.com>

On Sun, 2005-01-23 at 18:32 +0800, andyliu wrote:
> hi, adrian
> 
> i always see patches which set functions and variables to static.
> what's the main difference between static and non-static things?

1) namespace; static functions/variables are not visible name wise to
other .c files
2) optimisation: because of 1), gcc can know that there are no outside
users (assuming also no address-off is taken, which gcc also knows), and
in that case gcc can do a series of extra optimisations (such as more
agressive inlining, since gcc knows the exact user count of the function
now, but also gcc 3.4 will do things like make the function be regparm=3
equivalent, tail/head optimisations are possible (eg partial inlining)




  reply	other threads:[~2005-01-23 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-23 10:17 Adrian Bunk
2005-01-23 10:32 ` andyliu
2005-01-23 11:03   ` Arjan van de Ven [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-11-24 23:10 [2.6 patch] drivers/block/: some cleanups Adrian Bunk
2004-11-25 10:12 ` Christoph Hellwig
2004-11-29 12:28   ` [2.6 patch] loop.c: make two functions static Adrian Bunk

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=1106478230.6129.10.camel@laptopd505.fenrus.org \
    --to=arjanv@infradead.org \
    --cc=bunk@stusta.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liudeyan@gmail.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

all inboxes | Powered by JetHome®