Chapter 8. Development with C++
This chapter covers
When I need to crunch numbers at high speed, I prefer to write code in C. This is because my favorite compilers are optimized for high-speed processing, the executables tend to be small, and there’s usually plenty of code available on the internet from which I can draw inspiration.
But when my application needs to do more than just crunch numbers, such as animate an assemblage of moving parts, I prefer an object-oriented (OO) language like C++. This gives me the benefits associated with OO programming, such as polymorphism, inheritance, and encapsulation. It also provides a wealth of capabilities through the C++ Standard Template Library (STL) and the Boost libraries.
The OpenCL Working Group provides a C++ Wrapper API that makes it possible to code full-featured OpenCL host applications in C++. This API provides many advantages over the regular C API, and three of the most important advantages are as follows: