gnustep / libobjc2

Objective-C runtime library intended for use with Clang.
http://www.gnustep.org/
MIT License
434 stars 118 forks source link

Update runtime defines to match Apple platforms #212

Closed triplef closed 2 years ago

triplef commented 2 years ago

This updates the defines for YES, NO, nil, and Nil to match Apple platforms:

Apple’s implementation is e.g. available here for reference (__DARWIN_NULL is defined as NULL): https://opensource.apple.com/source/objc4/objc4-818.2/runtime/objc.h.auto.html

davidchisnall commented 2 years ago

Thanks. I don't like the changes to nil and Nil because those originally existed for explicit type checking that you really meant a null Objective-C object / class. ZipArchive/ZipArchive#573 is fixing a real bug according to the language spec, just not a high impact one. Apple eventually gave up trying to get people to fix these bugs defined these both to NULL because otherwise people turned off compiler warnings. Unfortunately we probably have to do the same thing. It would be nice if we could have the old definitions guarded on something like #ifdef I_KNOW_THE_DIFFERENCE_BETWEEN_AN_OBJECT_POINTER_AND_A_C_POINTER but it's probably 20 years too late.

triplef commented 2 years ago

Yeah totally agree...