public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: n l <walking.to.remember@gmail.com>
Cc: Giuliano Pochini <pochini@denise.shiny.it>, linux-kernel@vger.kernel.org
Subject: Re: why the interrupt handler should be marked "static" for it is never called directly from another file.
Date: Thu, 11 Aug 2005 08:41:10 -0700	[thread overview]
Message-ID: <42FB7196.8000408@vmware.com> (raw)
In-Reply-To: <6b5347dc0508110203345af854@mail.gmail.com>

n l wrote:

>I see, if a function in a module is not marked by static ,it can be
>accessed by any other function in kernel, while , using a static can
>avoid it .
>
>thanks a lot !!
>
>
>2005/8/11, Giuliano Pochini <pochini@denise.shiny.it>:
>  
>
>>On Thu, 11 Aug 2005, n l wrote:
>>
>>    
>>
>>>could you explain its reason for using static ?
>>>      
>>>
>>Anything which is never referenced from another file should be
>>static in order to keep namespace pollution low.
>>

There is actually another very good reason as well.  By marking 
functions static, you are telling the compiler that they may be only 
used in that file.  This allows the compiler to remove unused functions, 
which would be left in if implicitly declared "extern" by omitting the 
static.

Zach

      reply	other threads:[~2005-08-11 15:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-11  8:33 why the interrupt handler should be marked "static" for it is never called directly from another file n l
2005-08-11  8:52 ` Giuliano Pochini
2005-08-11  9:03   ` n l
2005-08-11 15:41     ` Zachary Amsden [this message]

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=42FB7196.8000408@vmware.com \
    --to=zach@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pochini@denise.shiny.it \
    --cc=walking.to.remember@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