When it comes to mobile game development on iOS and Android NDK, some developers write their own C++ containers, while others claim that STL is more than adequate for mobile game development (For example, the author of iPhone 3D Programming uses STL rather than Objective-C in his examples. His defense is that STL is no slower than Objective-C).

Then there are also mobile developers who abandon C++ entirely and develop games entirely (or mostly) in the C language (C89/C90).

What are the benefits and drawbacks of each approach?

  • 4
    \$\begingroup\$ The main criticisms against the STL are it's unpredictable memory allocation patterns and compiler support - both problems can be solved by using a STL alternative, for example EASTL or STLPort. \$\endgroup\$
    – Raphael R.
    Sep 28, 2011 at 13:51
  • 1
    \$\begingroup\$ Several answers from this question: gamedev.stackexchange.com/questions/268/… touch on mobile platforms and should give you your answer. \$\endgroup\$
    – Tetrad
    Sep 28, 2011 at 14:35
  • 5
    \$\begingroup\$ I suspect for many of the people "abandoning" (more like, not ever using) C++ on mobile platforms it's less about STL and more about the awkwardness of Objective-C++ (and C++ support lagging generally on Apple's toolchain). \$\endgroup\$
    – user744
    Sep 28, 2011 at 16:42
  • \$\begingroup\$ The real question is, can you write better? You're better off understanding the STL; and in the cases where it doesn't do what you want, implementing the behaviour you so require. \$\endgroup\$ Jun 15, 2012 at 9:15

1 Answer 1


Let me tell you one thing first. C++ is faster than Objective-C calls. Objective-C uses message passing systems so it will have some runtime overhead when compared to C++. Just have a look at some of the comparisons here.

Coming to iOS general "app" development, it makes sense to use Objective-C built-in functions as performance cannot be a much criteria to some extent. But in game development, we need to consider these results.

When I was working on my previous project (Robokill), we optimized most of the code where ever necessary with plain-C calls (we converted our Objective-C particles class to a C++ class). Or you can even use Objective-C runtime functions for direct C calls.

Coming to your question, here's my answer: yes, STL is well optimized for its purpose. Even though the implementation code is not much readable, it's interesting to check the implementation once.

However, we can optimize Objecive-C code to some extent, by pre-caching the function pointers and making calls with the Objective-C runtime.

Hope this helps!


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .