Tricks

Little-known facts that can make the job of a programmer easier are the focus of these sections. Some of these help determine system and development environment characteristics, and are reused in the second half of the chapter, in which compatibility and portability of sources is discussed.

Recognizing Code: C or C++

When mixing C and C++, you may at some point want to determine at runtime what kind of compiler was used. This is because C and C++ compilers generate subtly different code (think of calling conventions for function, sizes of variable types, and so on). Listing 14.1 shows how you can determine at runtime whether a source was compiled with a C compiler or a C++ compiler. It does this by looking at the size of a constant ...

Get C++ Footprint and Performance Optimization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.