public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* why the interrupt handler should be marked "static" for it is never called directly from another file.
@ 2005-08-11  8:33 n l
  2005-08-11  8:52 ` Giuliano Pochini
  0 siblings, 1 reply; 4+ messages in thread
From: n l @ 2005-08-11  8:33 UTC (permalink / raw)
  To: linux-kernel

could you explain its reason for using static ?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: why the interrupt handler should be marked "static" for it is never called directly from another file.
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Giuliano Pochini @ 2005-08-11  8:52 UTC (permalink / raw)
  To: n l; +Cc: linux-kernel



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.


--
Giuliano.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: why the interrupt handler should be marked "static" for it is never called directly from another file.
  2005-08-11  8:52 ` Giuliano Pochini
@ 2005-08-11  9:03   ` n l
  2005-08-11 15:41     ` Zachary Amsden
  0 siblings, 1 reply; 4+ messages in thread
From: n l @ 2005-08-11  9:03 UTC (permalink / raw)
  To: Giuliano Pochini; +Cc: linux-kernel

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.
> 
> 
> --
> Giuliano.
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: why the interrupt handler should be marked "static" for it is never called directly from another file.
  2005-08-11  9:03   ` n l
@ 2005-08-11 15:41     ` Zachary Amsden
  0 siblings, 0 replies; 4+ messages in thread
From: Zachary Amsden @ 2005-08-11 15:41 UTC (permalink / raw)
  To: n l; +Cc: Giuliano Pochini, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-08-11 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox