When pass-by-pointer is preferred to pass-by-reference in C++?

前端 未结 13 1417
南笙
南笙 2020-12-02 18:46

I can imagine one case, in which the input parameter could be NULL so that pass-by-pointer is preferred but not pass-by-reference?

Can anybody add more cases?

13条回答
  •  自闭症患者
    2020-12-02 19:01

    Google seems to have a strong opinion on this, and I tend to agree:

    http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Reference_Arguments

提交回复
热议问题