Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: Globals and...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 14 Topic 26067 of 26959
Post > Topic >>

Re: Globals and Ex****ts

by "Malcolm McLean" <regniztar@[EMAIL PROTECTED] > May 5, 2008 at 09:40 PM

"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
 




 14 Posts in Topic:
Globals and Exports
"Bartc" <bc@  2008-05-05 09:53:12 
Re: Globals and Exports
Antoninus Twink <nospa  2008-05-05 12:12:43 
Re: Globals and Exports
"Bartc" <bc@  2008-05-05 11:00:02 
Re: Globals and Exports
Flash Gordon <spam@[EM  2008-05-05 12:12:28 
Re: Globals and Exports
Flash Gordon <spam@[EM  2008-05-05 11:40:48 
Re: Globals and Exports
Mark McIntyre <markmci  2008-05-05 12:18:00 
Re: Globals and Exports
Antoninus Twink <nospa  2008-05-05 15:00:02 
Re: Globals and Exports
Flash Gordon <spam@[EM  2008-05-05 14:16:25 
Re: Globals and Exports
"Malcolm McLean"  2008-05-05 21:40:52 
Re: Globals and Exports
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-05 09:55:27 
Re: Globals and Exports
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-05 10:02:48 
Re: Globals and Exports
Martin Ambuhl <mambuhl  2008-05-05 15:06:55 
Re: Globals and Exports
John Bode <john_bode@[  2008-05-05 16:07:30 
Re: Globals and Exports
Nick Keighley <nick_ke  2008-05-06 03:17:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 16:14:41 CDT 2008.