-
Book Overview & Buying
-
Table Of Contents
C++ Memory Management
By :
There are many uses for placement new (an important feature discussed in Chapter 7, as you might remember) but one use that is particularly interesting is that it allows us to map software objects to memory-mapped hardware, effectively allowing us to drive hardware as if it was software.
A working example of this feature would be tricky to write as we would find ourselves in “non-portable code land,” using operating-system-specific features to get the address of a particular device and discussing ways to get read and write privileges to memory locations normally accessed by software drivers. For that reason, we will craft an artificial yet illustrative example and ask you, esteemed reader, to imagine that the missing parts of this example exist.
First, suppose that we are developing a driver for a new video card, one that is so wonderful that its codename is super_video_card. For the sake of this illustration, we will model...