79739644

Date: 2025-08-19 08:33:58
Score: 1
Natty:
Report link

int* const Foo(); is the same as int* Foo();.

The const here would apply to the pointer itself, but since the function returns it by value (a prvalue), there’s no object for that const to bind to. The temporary pointer can’t actually be made const, so the qualifier is ignored.

If you want the pointed-to value to be const, you’d write:

const int* Foo();

but int* const Foo(); doesn’t add anything over just int* Foo();.

Reasons:
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: RomboCombo