Intermediate Compilers & Programming Language Theory
Q56 / 100

What is monomorphization in generics/templates?

Correct! Well done.

Incorrect.

The correct answer is B) Generating separate concrete code copies for each distinct type a generic function/class is used with, ensuring zero runtime overhead at the cost of code size

B

Correct Answer

Generating separate concrete code copies for each distinct type a generic function/class is used with, ensuring zero runtime overhead at the cost of code size

Explanation

Monomorphization (C++ templates, Rust generics): vector<int> and vector<string> generate separate compiled code. Zero overhead since no type erasure. Tradeoff: binary size. Java/Go use type erasure instead.

Progress
56/100