6

I am aware of the C++ Virtual Table which allows dynamic dispatch for doing things at runtime (although if I am honest I am not completely sure of the full list of things it achieves).

I am wondering what other "low level" aspects of C++ are there, which one doesnt usually come across when learning the C++ language?

Things like:

-How is multithreading and locking on objects performed?

-Overloading/overwriting functions

-Generics

Are there other "structures", similar to the vtable, which assist with these types of things on a lower level?

(and if anyone can help with what the VTable actually does it would be most appreciated!)

6
  • 2
    C++ ABI is not standartised at all, every compiler on each platform does its own thing. If you want a sample of what they're doing, read one of the numerous possible ABI specs, like this one: refspecs.linuxbase.org/cxxabi-1.83.html
    – SK-logic
    Commented May 9, 2012 at 12:40
  • If I was interested in the Intel Compiler, I dont suppose you would know the best place for me to look? Would Intel have good "under the bonnet" details on their compiler? Last time I checked i couldnt find anything. Im guessing because its commercial they wouldnt reveal much about what it does....
    – Roger
    Commented May 9, 2012 at 12:43
  • Itanium ABI is actually used by a number of the open source compilers as well (at least its name mangling part, not the VTable structures). And all the other ABIs are specified as well, just pick up the platform you're interested in and google for "<platform name> <compiler name> C++ ABI spec".
    – SK-logic
    Commented May 9, 2012 at 12:52
  • found the Unix Intel Itanium one, but couldnt find the x86
    – Roger
    Commented May 9, 2012 at 13:56
  • 1
    These are not subjects that you want or need to know about unless you plan to implement a compiler. Commented May 9, 2012 at 18:25

1 Answer 1

4

Virtual Table

I would guess that the most official description of virtual tables would be found in chapter 10 of The Annotated C++ Reference Manual (sometimes called ARM) by Margaret Ellis and Bjarne Stroustrup. My copy is copyright 1990, not sure if that is the latest edition.

There are probably simpler, more graphic descriptions like

http://www.learncpp.com/cpp-tutorial/125-the-virtual-table/

or right here on Stack Exchange:

https://stackoverflow.com/questions/2173493/virtual-table-c

How is multithreading and locking on objects

I think this is not part of the original language.

p-threads (POSIX Threads) are a typical way to augment the language with a library and are supported on UNIX, Linux, and other operating systems including, surprisingly enough, even Windows.

Another library that supports threads is Boost. I read somewhere than some of the Boost threading support was adopted by the C++ standards committee and appears in C++11.

C++11 supports threads in an update to the standard library. There is also a notion of thread local storage that is described briefly from the same reference.

Overloading/overwriting functions

Chapter 13 of the ARM discusses this topic.

Generics

In C++ this would be templates.

Check chapter 14 of the ARM.

1
  • Sadly the ARM has not been updated. The problem (if I remember correctly) is that they couldn't get the text of the standard for some reason (I don't know if it was licensing or fees or what). Commented Sep 7, 2012 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.