• 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: Cocoa-dev Digest, Vol 16, Issue 72
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa-dev Digest, Vol 16, Issue 72


  • Subject: Re: Cocoa-dev Digest, Vol 16, Issue 72
  • From: Turtle Creek Software via Cocoa-dev <email@hidden>
  • Date: Tue, 27 Aug 2019 15:35:35 -0400

We are happy with the lifetime management in our C++ classes.
And C++ keeps improving.  ARC doesn't go there and that is fine.

We tried QT early on, but decided against it.

Casey McDermott
TurtleSoft.com


On Tue, Aug 27, 2019 at 2:35 PM Jens Alfke <email@hidden> wrote:

>
>
> On Aug 26, 2019, at 6:22 PM, Turtle Creek Software <email@hidden>
> wrote:
>
> There are links between each Cocoa control class and its matching C++
> control (which also owns a native MFC control).
> Also links between the view and our C++ controller, to load window layouts
> and set up the control links.
> A couple utility links for showing progress bars, log window, etc.
>
>
> Ah, OK. Your C++ code goes higher up the stack than I thought. (It sounds
> like using Qt would have been a good idea, but it's probably much too late
> to rethink that now.)
>
> My suggestion is simply to compile all your C++ code as Objective-C++. In
> your project settings just tell Xcode to map the ".cpp" suffix to
> Objective-C++ instead of C++.
>
> Then you can refer to Cocoa classes by their regular names in the C++
> code, just as if you were writing Objective-C. ARC will automatically
> manage their reference-counting. If you have an NSButton* data member in a
> C++ class, the compiler will insert retain/release when it's assigned, and
> will add a -release call to your destructor. (Just make sure to initialize
> it to nil in its declaration!)
>
> This way you aren't fooling the compiler, and it can do the right thing
> with reference-counts.
>
> For x-plat compatibility, you can either #ifdef out the places those are
> referred to, or conditionally declare those class names as bogus C++
> classes:
>
> #ifndef __APPLE__
> namespace cocoa {
> class NSButton;
> class NSWindow;
> …
> }
> #endif
>
> —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: Cocoa-dev Digest, Vol 16, Issue 72
      • From: Jens Alfke via Cocoa-dev <email@hidden>
References: 
 >Re: Cocoa-dev Digest, Vol 16, Issue 72 (From: Turtle Creek Software via Cocoa-dev <email@hidden>)
 >Re: Cocoa-dev Digest, Vol 16, Issue 72 (From: Jens Alfke via Cocoa-dev <email@hidden>)
 >Re: Cocoa-dev Digest, Vol 16, Issue 72 (From: Turtle Creek Software via Cocoa-dev <email@hidden>)
 >Re: Cocoa-dev Digest, Vol 16, Issue 72 (From: Jens Alfke via Cocoa-dev <email@hidden>)
 >Re: Cocoa-dev Digest, Vol 16, Issue 72 (From: Turtle Creek Software via Cocoa-dev <email@hidden>)
 >Re: Cocoa-dev Digest, Vol 16, Issue 72 (From: Jens Alfke via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: Recommendations for cross platform library/framework
  • Next by Date: Re: Cocoa-dev Digest, Vol 16, Issue 72
  • Previous by thread: Re: Cocoa-dev Digest, Vol 16, Issue 72
  • Next by thread: Re: Cocoa-dev Digest, Vol 16, Issue 72
  • Index(es):
    • Date
    • Thread