top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Can we use exception, C++11 and RTTI in middle-ware component when used in Android

0 votes
101 views

I write Android module in C++ using the Android Platform Development Kit to write middle-ware component like the Audio HAL.

I see in the NDK we can use exception, c++11 and RTTI, but I do not use the NDK but the "PDK". Everybody in my team say "PDK" do not support these but I do not find any AOSP documentation saying is not support and why.

I see in build/core/binary.mk there are a variable LOCAL_RTTI_FLAG we can define to "LOCAL_RTTI_FLAG := -frtti" to enable RTTI but there are no component using this except "external/icu4c/common/Android.mk" and "external/icu4c/i18n/Android.mk". Did this feature can be use or is just experimental ?

The only documentation I found about exception is in bionic/libc/docs/OVERVIEW.TXT, explain some problem we can have using exception with bionic. But I want to know, if is the only problem with C++ exception in Android?

I did not find anything about C++11 in AOSP, I do not find any "c++11" in Android.mk. Can you say me if we can use c++11?

posted Jul 11, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

Full C++11 support is not ready yet with the NDK, and I don't have an ETA, though were working on it (by porting llvms libc++, stlport cannot support it, and the various GCC-version-specific GNU libstdc++ implementations are a PITA to work with anyway).

The platform C++ compiler is currently based on GCC 4.7 so technically supports a few C++11 language features, problems will arise if you try to use certain C++11 STL features though. I cant tell you which, so assume you should not use them, but feel free to experiment.

Exception / RTTI support in the NDK is provided by statically linking the appropriate C++ runtime libraries into application-specific libraries. I don't know if such support is available from the platform system libraries, but LOCAL_RTTI_FLAG in the platform build system seems to indicate so.

If you're building a custom image, you should be able to do what you want as long as you don't modify the NDK-exposed system libraries. This includes /system/lib/libstdc++, which is _not_ a real C++ runtime.
Hope this helps,

answer Jul 11, 2013 by anonymous
Similar Questions
+1 vote

Are C++11 final classes really final, or is it still possible to define a derived class through some hack without violating language rules?

It seems we devirtualize calls to virtual members of final classes in some cases, so I assume final is really final, but I'm not sure. :-)

+6 votes

First see this example: let you have a number 8 which is divisible by 4 which is square of 2 and 27 which is divisible by 9 which is square of 3.I need a solution for numbers input from 1 to 10^18.hope for efficient program written in any programming language.
Thanks in advance.


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...