C Programming help .....wtf ?!?!

Kurt Wall kwall
Sat Jan 29 17:00:27 PST 2005


On Saturday 29 January 2005 16:20, A. Khattri wrote:
> On Sat, 29 Jan 2005, Alma J Wetzker wrote:
> > You should not need to worry about local variables, even if they
> > are static. Global variables, definitions and functions are where
> > name collisions take place.
>
> If you declare a global variable in a file "static" then becomes
> global but ONLY to that file.

Precisely. At least for C. I forget what happens with C++.

> This can help in multi-file projects.

Right. It prevents (minimizes) namespace collisions and can also help 
the compiler with certain types of optimizations.

Kurt


More information about the Linux-users mailing list