Re: [Boost-bugs] [Boost C++ Libraries] #5010: Fusion will now compile under Objective-C++

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5010: Fusion will now compile under Objective-C++
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-05 19:02:44


#5010: Fusion will now compile under Objective-C++
---------------------------------------------+------------------------------
  Reporter: Brian Doig <Brian.Doig@…> | Owner: djowel
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: fusion
   Version: Boost 1.45.0 | Severity: Showstopper
Resolution: | Keywords:
---------------------------------------------+------------------------------

Comment (by brian.doig@…):

 "with a proper warning that nil is being renamed and will therefore break
 compatibility where/if it's used on such platforms or with such
 libraries."
 ----
 The keyword nil is just a NULL pointer that is tagged with a different
 name so that the compiler knows to treat it as an objective-c object.
 Changing the definition of nil is equivalent to changing the definition of
 NULL under C++ to be something other than what the standard expects. That
 seems rather dangerous to me.

 Under Obj-C++ you can legally message a nil pointer. It ignores the
 message and any return value is zero. There are many places in the
 language that depend on this functionality. Changing the definition of
 nil could potentially break code everywhere in an application

 If you need to maintain nil for backwards compatibility purposes, then use
 a pre-processor test to check if the code is being compiled for
 objective-c and if so use a different symbol name. Or perhaps you could
 change it so that it's always nil_ but when not under objective-c you also
 define an alias of nil = nil_ so that the old code works.

 Is this problem tough to fix? Yes, but the iPhone/iPad/Mac are going to
 become more popular and the missing libraries from boost due to this are
 going to become larger and larger problems as time goes by.

 Nil is defined as follows. Perhaps there is some way to make the nil used
 by obj-c be semantically equivalent to how fusion defines nil?
 {{{
 <objc/objc.h>
 #ifndef nil
 #define nil __DARWIN_NULL /* id of Nil instance */
 #endif

 <sys/_types.h>
 #ifdef __cplusplus
 #ifdef __GNUG__
 #define __DARWIN_NULL __null
 #else /* ! __GNUG__ */
 #ifdef __LP64__
 #define __DARWIN_NULL (0L)
 #else /* !__LP64__ */
 #define __DARWIN_NULL 0
 #endif /* __LP64__ */
 #endif /* __GNUG__ */
 #else /* ! __cplusplus */
 #define __DARWIN_NULL ((void *)0)
 #endif /* __cplusplus */
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5010#comment:15>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC