-

@ Dan Piponi
2025-03-07 00:00:00
A C++ observation.
We could write the type signature of some function f as
void f(int x)
or, if we intend not to mutate x during f's computation, we can use
void f(const int x).
This is entirely a private affair in the sense that f gets a copy of x so f can do whatever it likes with x. But the type signature is "public". So it leaks irrelevant information about the internals of f.
Or am I missing something?
Obviously this is entirely different to f(int &) vs f(const int &).