15.3. Compiler Quirks

C++ compilers are complex pieces of software. Sadly, sometimes the details of a compiler's implementations leak out and bother the application programmer. The two aspects of C++ compiler implementation that have caused grief in the past are efficient template instantiation and name mangling. The following sections explain each of these aspects.

15.3.1. Template Instantiation

The problem with template instantiation exists because of a number of complex constraints:

  • The compiler should generate only an instance of a template once, to speed the compilation process.

  • The linker needs to be smart about where to locate the object code for instantiations produced by the compiler.

Separate compilation exacerbates this problem—that ...

Get GNU Autoconf, Automake, and Libtool now with O’Reilly online learning.

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