Why this is causing C2102: '&' requires l-value

前端 未结 5 1389
无人共我
无人共我 2021-01-02 12:16

I was wondering, why the following way of code (Already commented out) will cause
C2102: \'&\' requires l-value

Is there a better way to avoid u

5条回答
  •  梦谈多话
    2021-01-02 12:55

    The & operator must be applied to an lvalue. When the call aa.get_dummy() is not assigned to a variable, its return value is only put on the stack, so it would be silly (and erroneous) to get the address of a stack item.

提交回复
热议问题