"Antoninus Twink" <nospam@[EMAIL PROTECTED]
> wrote in message
news:slrng1u16i.rsv.nospam@[EMAIL PROTECTED]
> On 5 May 2008 at 11:12, Flash Gordon wrote:
>> So what is wrong with static? Why suggest a non-standard extension when
>> a feature the language has had in all implementations for years is
>> sufficient.
>
> Because they do different things. If you're making a shared library,
> then you might want to have variables and functions that are globally
> visible within your library, but don't pollute the namespace for users
> of your library. Gcc's __attributes can achieve that.
>
> Without extensions, you have only two choices: either make a variable
> static, and so visible only within a single translation unit, or else
> make it globally visible everywhere. Compiler extensions can provide
> finer-grained visibility control, which seems to be what the OP had in
> mind: when you link your shared library, all uses of a symbol throughout
> the library files are resolved, but that symbol isn't put into the table
> of externally-visible symbols in your .so file.
>
This is something that ought to be added to the language, I quite agree.
Very frequently you want library scope functions and variables.
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm


|