Is the const value parameter in definition but not declaration really C++?

前端 未结 7 1409
时光说笑
时光说笑 2021-01-06 13:31

This is similar to (but different from) this question.

Here is some simple test code to illustrate some weirdness I have discovered with Sun CC:

//--         


        
7条回答
  •  灰色年华
    2021-01-06 14:05

    My understanding is that this is allowed because it makes little difference for the caller. It is not the function that is const, but rather a parameter, and you are making the addition in the definition. Thus, the const you actually added affects only the implementation

    See this question.

提交回复
热议问题