• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Xcode 5 & Obj-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode 5 & Obj-C++


  • Subject: Re: Xcode 5 & Obj-C++
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 30 Jan 2014 13:26:59 -0800

On Jan 30, 2014, at 4:32 AM, Jean-Daniel Dupas <email@hidden> wrote:

> It is barely possible to create a stable ABI in C++. This language suffers all possible form of fragile base class problem:
> Add a new ivar, all subclasses and stack allocated objects are broken.
> Add a new virtual method, you break all virtual subclasses.

Exactly. Also, the use of templates or inline methods in library classes will cause library code to get built into the calling app at compile time. After that, the library has to be very careful not to break compatibility with such code to avoid breaking the app. A typical obvious example is changing the implementation of an inline method; newly compiled apps will get the new behavior but existing apps will keep the old behavior since the inlined code is in the app not the library. That's bad news if the old inline method accesses private state of the old version of the class that no longer exists in the same form in the new version.

It is possible to create binary-compatible C++ APIs but you have to be very, very careful — generally there are a lot of rules about the use of inlines and templates; you have to add placeholder data members and virtual methods to classes to reserve room for future expansion, etc.

—Jens
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Xcode 5 & Obj-C++
      • From: Eric Wing <email@hidden>
References: 
 >Xcode 5 & Obj-C++ (From: Peter Teeson <email@hidden>)
 >Re: Xcode 5 & Obj-C++ (From: Uli Kusterer <email@hidden>)
 >Re: Xcode 5 & Obj-C++ (From: Uli Kusterer <email@hidden>)
 >Re: Xcode 5 & Obj-C++ (From: Eric Wing <email@hidden>)
 >Re: Xcode 5 & Obj-C++ (From: Jens Alfke <email@hidden>)
 >Re: Xcode 5 & Obj-C++ (From: "email@hidden" <email@hidden>)
 >Re: Xcode 5 & Obj-C++ (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: Xcode 5 & Obj-C++
  • Next by Date: Re: Xcode 5 & Obj-C++
  • Previous by thread: Re: Xcode 5 & Obj-C++
  • Next by thread: Re: Xcode 5 & Obj-C++
  • Index(es):
    • Date
    • Thread