top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

C++11 final classes

+1 vote
413 views

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. :-)

posted Oct 14, 2013 by Jagan Mishra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

It's intended to be really final, so devirtualization is allowed.

answer Oct 14, 2013 by Mandeep Sehgal
I say "intended" because people manage to do some highly unexpected things within the rules of the language, but I haven't seen any ways of "breaking" final, and I think they'd be against the spirit of the standard, if not the letter.
Similar Questions
0 votes

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?

+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.

0 votes

how can I configure GCC to emit the calls to __cxa_thread_atexit() for destructor registration? On a Linux PowerPC target I see the registration of destructors, but not on the powerpc-rtems target. I guess I missed a configuration option or define. Has someone a hint for me?

...