discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: weak redefinition


From: David Chisnall
Subject: Re: weak redefinition
Date: Tue, 14 Apr 2015 15:32:36 +0100

On 14 Apr 2015, at 15:04, Riccardo Mottola <riccardo.mottola@libero.it> wrote:
> 
> Hi,
> 
> David Chisnall wrote:
>> It appears that all NetBSD headers are incompatible with Objective-C.  
>> Probably worth filing a bug with them - this is even harder to work around 
>> than the glibc issue of using __block as a variable name.
> 
> I reported to NetBSD and they said it is a bug in obj-c or gnustep, because 
> we don't have to mess around with symbols with __ as prefix because they are 
> system reserved.
> The most polite reply I got is
> "Don't blame NetBSD though, because these are system headers..."
> 
> Now it was easy before: until latest release 6.1.5 NetBSD did not define 
> __weak but
> #define __weak_reference(sym)   __attribute__((__weakref__(#sym)))

__weak is a keyword in Objective-C (and was before the last NetBSD release).  
If they use a language keyword in their system headers, then they can not 
expect it to work.  Identifiers starting with a double underscore are reserved 
for ‘the implementation’ in C.  Objective-C uses __weak, __strong, 
__unsafe_unretained, __block, and a few others.  These are all prefixed with a 
double underscore to avoid conflicts with other identifiers and because the 
compiler is part of ‘the implementation’.

NetBSD intentionally used an identifier that had been part of the Objective-C 
language for several years before they made this decision.  That’s their 
choice, but it means that you can not use Objective-C with NetBSD system 
headers.

David

-- Sent from my STANTEC-ZEBRA




reply via email to

[Prev in Thread] Current Thread [Next in Thread]