Top-level const doesn't influence a function signature

后端 未结 7 2042
悲哀的现实
悲哀的现实 2020-11-27 08:32

From the C++ Primer 5th Edition, it says:

int f(int){ /* can write to parameter */}
int f(const int){ /* cannot write to parameter */}

The

7条回答
  •  甜味超标
    2020-11-27 08:39

    I think the indistinguishable is used in the terms of overloading and compiler, not in terms if they can be distinguished by caller.

    Compiler does not distinguish between those two functions, their names are mangled in the same way. That leads to situation when compiler treats those two declarations as redefinition.

提交回复
热议问题