Is there ever a reason to use C++ in a Mac-only application?

Posted by Emil Eriksson on Programmers See other posts from Programmers or by Emil Eriksson
Published on 2011-11-27T15:33:12Z Indexed on 2011/11/27 18:04 UTC
Read the original article Hit count: 367

Filed under:
|
|
|

Is there ever a reason to use C++ in a Mac-only application? I not talking about integrating external libraries which are C++, what I mean is using C++ because of any advantages in a particular application. While the UI code must be written in Obj-C, what about logic code?

Because of the dynamic nature of Objective-C, C++ method calls tend to be ever so slightly faster but does this have any effect in any imaginable real life scenario? For example, would it make sense to use C++ over Objective-C for simulating large particle systems where some methods would need to be called over and over in short time?

I can also see some cases where C++ has a more appropriate "feel". For example when doing graphics, it's nice to have vector and matrix types with appropriate operator overloads and methods. This, to me, seems like it would be a bit clunkier to implement in Objective-C. Also, Objective-C objects can never be treated plain old data structures in the same manner as C++ types since Objective-C objects always have an isa-pointer. Wouldn't it make sense to use C++ instead in something like this?

Does anyone have a real life example of a situation where C++ was chosen for some parts of an application? Does Apple use any C++ except for the kernel?

(I don't want to start a flame war here, both languages have their merits and I use both equally though in different applications.)

© Programmers or respective owner

Related posts about c++

Related posts about iphone