C++ – const reference parameters

c++

Is there a difference between the following declarations?

void somefunc(const Person &p);
void somefunc(Person const &p);

Best Solution

there is no difference. const binds to the type to its left...unless it is the first part of the declaration in which case it binds to the right.

See: https://isocpp.org/wiki/faq/const-correctness#const-ref-alt

Personally, I find that const T &x reads better. According to this, Bjarne also prefers to put the const first. Specifically because the keyword was originally going to be called readonly and readonly int x reads better :-P.