【发布时间】:2012-02-23 21:33:49
【问题描述】:
您认为每次值不会更改时严格使用const 或仅在数据将被修改时将参数作为指针传递是否重要?
我想做正确的事情,但是如果作为参数传递的struct 的大小很大,您不想传递地址而不是复制数据吗?通常,将struct 参数声明为操作数似乎是最实用的。
//line1 and line2 unchanged in intersect function
v3f intersect( const line_struct line1, const line_struct line2);
//"right" method? Would prefer this:
v3f intersect2( line_struct &line1, line_struct &line2);
【问题讨论】:
标签: c struct arguments constants operands