On 13 Nov 2017, at 08:17, Wolfgang Lux <[email protected]> wrote:
> 
> While sel_isEqual is just an alias for == on Apple's runtime (and the GNUstep 
> runtime, I assume), this need not be the case for other runtimes. In 
> particular, for the old GNU runtime sel_isEqual is not equivalent to ==, as 
> you've observed.

It’s also not == on the GNUstep runtime, and can’t easily be with a new ABI if 
we want it to work on ELF / COFF platforms.  Apple relies on the run-time 
linker deduplicating their selector table and inserting selectors into a 
contiguous region of memory.  

With the GNUstep (or GCC) runtime, == will work if both selectors are defined 
(i.e. created from @selector, or from a caller setting the _cmd parameter) in 
the same compilation unit.  With the new ABI that’s I’m (intermittently) 
working on, it will work in the same DSO, but in both cases it’s fragile.

Clang will warn if you do == comparisons on selectors (even on OS X), so I’m 
surprised that this code has survived the last few years.

PSA: Even if you really like GCC and want to use GCC for all of your shipping 
code, please make sure that it compiles with clang -Werror before spending ages 
trying to figure out why it’s broken.  The clang static analyser will also find 
a load more common bugs in Objective-C.

David


_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to