Why and when should I use C / C ++ code in an iOS app?

When and in particular why should I switch from Objective-C to C or C ++ when I develop on the iOS platform. I'm sure something is missing, but as far as I can see, Apple wants developers to use Objective-C everywhere in the Mac / iOS environment, so why should I go with C / C ++?

However, I am not talking about GAME DEVELOPMENT. In the case of games, I understand the advantages. I just don't get it when I want to use C if I am developing, for example, a client for a server or something like that (again, not a game). All the classes that I need are already there, and they are all in Objective-C.
+5
source share
4 answers

The goal of C is the strict ANSI C superset, which is why the Objective-C programmer most likely already does a significant part of C programming. In fact, many Mac and iOS APIs (audio, graphics, etc.) are C-interfaces and / or use data types C.

, - C, , , . Objective C, .. C iOS, Linux, Android NDKs, PDOS WebOS .. Objective C API C.

, ++ iOS, - - ++ , ..

iOS, , Objective C ( C), , , , , API iOS .

+4

- . , ++ C, , , iOS Android Blackberry .. (Zebra Crossing and OpenCV ).

( ) - , C ++ Objective-C.

+4

, : (a) ++, ( Objective C), (b) ++ / Objective C.

+2

, . " ++". , ++ 11 , ++ 98. , , , , ".m" ".mm". ( ).

As for the why. Some Apple APIs had more features in one language than others. For example, it used to be (and still may be) that a bunch of graphical / fast functions are only available through cocoa interfaces, not C object interfaces.

It is even more likely that some third-party libraries may only be available in one language.

0
source

All Articles