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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.