Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C vs C++ (Objective-C vs Objective-C++) for iPhone

I would like to create a portable library for iPhone, that also could be used for other platforms.

My question is the fallowing:

Does anyone knows what is the best to be used on the iPhone: Objective-C or Objective-C++? Does it works with C++ the same way as Objective-C with C or not?

Reasons: Objective-C is a superset of C, but Objective-C++ is not a superset of C++.

Thanks in advance!

UPDATE: What about memory usage, speed in the same implementation of an use case?

UPDATE1: If anyone can provide any more information, he'll be welcome.

like image 280
mxg Avatar asked Nov 14 '09 18:11

mxg


People also ask

Is Objective-C still used for iOS?

Most of the core iOS and MacOs software is still written in Objective-C, though Apple is pushing for new updates to be written in Swift.

Why is Objective-C used for iOS?

It's because Objective C has been the de facto language for Mac OS X development before it was Mac OS X. When Jobs left Apple to set up NeXT, the language Objective C was developed as a specific language that wasn't C++ and avoided many of its pitfalls.

Can you make an iOS app with Objective-C?

iOS applications are typically developed in a programming language called Objective-C and supported by a support library called Cocoa Touch.

Which is the better option for iOS App Swift or Objective-C Why?

According to Apple, Swift is approximately 2.6 times faster than Objective C. The speed calculated generally relates to the speed of coding. Swift's syntax is much more simple and direct than Objective-C. This enables developers to focus on the core part of the code rather than the rules on which the codes are based.


1 Answers

If you're writing a portable library, and don't need specific language features for it, why not write it in straight C? It can be easily called from C++, C, Objective-C, and many, many other languages.

If you require specific language features that aren't available in C, you should tell us what they are so you can get better advice =)

like image 150
Stephen Canon Avatar answered Sep 24 '22 15:09

Stephen Canon