All challenges
Multiple ChoiceIntermediate 45s

const and the trailing return / APIs

Why should member functions be `const`-qualified aggressively in a library API?
Options
  1. 1It improves runtime performance, because the compiler can skip the bounds checks it would otherwise emit.
  2. 2It is required by the one-definition rule for every inline function, so omitting it causes linker errors.
  3. 3It prevents the function from being inlined, which keeps generated code smaller and improves instruction cache use.
  4. 4Without it, a const object or const reference cannot call the function, breaking const-correctness propagation through callers.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle