[Top][All Lists]

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

Re: issue with auto-enable of Menus

From: Josh Freeman
Subject: Re: issue with auto-enable of Menus
Date: Mon, 13 Nov 2017 13:14:34 -0500

Hi Riccardo,

On Nov 13, 2017, at 5:24 AM, David Chisnall wrote:

On 13 Nov 2017, at 08:17, Wolfgang Lux <address@hidden> 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.

Note that Apple didn't add sel_IsEqual() to its runtime until OS X 10.5; If you still want Graphos to support OS X 10.4 & earlier, you'll need to keep using '==' on Macs. One way to do this without #ifdefs around each selector comparison would be to use a macro:

#ifdef __APPLE__
# define macroSelectorsAreEqual(selector1, selector2) (selector1 == selector2)
#else // GNUstep
# define macroSelectorsAreEqual(selector1, selector2) sel_isEqual(selector1, selector2)


if (macroSelectorsAreEqual(action, @selector(copy:))) {...

(It's probably safe to assume Apple's runtime will continue supporting '==' for selector comparison, otherwise it would break a significant amount of legacy code).



reply via email to

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