On Jun 26, 12:05 pm, Eurico Inocêncio <
eurico.inocen...@gmail.com>
wrote:
> I my view C++ exceptions and STL should be avoided in mobile/embedded
> environments. Both are great for desktop/server programming, but on
> mobile their cost is just too high, so the NDK approach makes perfect
> sense for mobile application development.
>
Yes, you wouldn't want reliable code running in mobile/embedded
environments. That would be a bad thing. ;)
Exceptions are a fundamental implementation detail. They can
drastically improve code robustness. And they certainly set error
handling strategies. One only needs to look at some of the code
reviews for Android to realize this (locking errors). Classic issues
like locking are often, simply a no-brainer with the use of
exceptions. C++ without exceptions is a gutted language resulting in a
glorified C + objects implementation.
As a side note, I have used C++ and exceptions in embedded projects.
They do add some bloat but their benefits far, far out weighs their
memory disadvantages; so long as code quality and robustness is the
least bit important to your project. That of course assumes you have
the memory to spare. On the other hand, its common for compilers to
have a flag which prevents emitting exception code. Which means, if
you don't need, want, or use exceptions, you have that option with no
penalty. So supporting exceptions typically means supporting the best
of both worlds. Removing exceptions means gutting the language which
immediately excludes lots of existing code and/or libraries. And given
the direction the mobile market is headed, it certainly seems it was a
very short sighted decision.
I am not looking to start a C++ flame war here - but removing
exceptions is a significant gutting of the C++ language. If you
disagree, go ahead, announce to the world exceptions are to be removed
from Java because they don't have a place in mobile/embedded
environments. I promise to sing, "Oh Danny Boy", on your special
day. ;)
Greg