Skip to contentSkip to conversation

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

DISCUSSION n l 3 participants 4 messages Aug 11, 2005

lore
Share & tools
lore

n l

author
#0 lore raw

could you explain its reason for using static ?

#1 lore raw
Quoted 1 line · n l

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.

author
#2 lore raw

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]>:

Quoted 13 lines · n l
Quoted 2 lines

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.

#3 lore raw
Quoted 4 lines · n l

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 .

Quoted 16 lines

thanks a lot !!

2005/8/11, Giuliano Pochini <[email protected]>:

Quoted 10 lines · n l
Quoted 6 lines

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