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

mxg picture mxg · Nov 14, 2009 · Viewed 25.8k times · Source

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.

Answer

Stephen Canon picture Stephen Canon · Nov 14, 2009

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 =)