weakref and static

Geoffrey Keating geoffk@apple.com
Sun Dec 18 04:35:00 GMT 2005


On 17/12/2005, at 10:08 AM, Jakub Jelinek wrote:

> But there are dozens of other uses of TREE_PUBLIC in the backends, so
> it wouldn't surprise me if something similar is not present on  
> other arches.
>
> Normal aliases are usually declared through
> extern __typeof (foo) bar __attribute__((alias ("foo")));
> eventhough the alias really is defined in that file, so I don't see  
> why
> weakref aliases couldn't be declared the same way.

In ISO C, 'extern' does not mean 'not defined in this file', it means  
'visible outside this file'.  For instance,

extern int x(void) { return 1; }
extern int i3 = 3;

are both valid ISO C, although they're unusual and the compiler warns  
about the second one.

The reason you can't define weakref aliases 'the same way' is because  
the functionality doesn't exist; there is no way to define a weakref  
which is visible outside the file it's defined in, the object file  
format doesn't support it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2408 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20051218/a35b8bc1/attachment.p7s>


More information about the Gcc mailing list