Re: why the interrupt handler should be marked "static" for it is never called directly from another file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>:
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux