【发布时间】:2014-06-01 04:34:40
【问题描述】:
是否可以将函数声明为pure 或const(使用GCC 属性),
返回参数 ? (其中参数用于返回值)。
例如:
void mid_v3_v3v3(float r_out[3], v0[3], v1[3])
{
r_out[0] = (v0[0] + v1[0]) * 0.5f;
r_out[1] = (v0[1] + v1[1]) * 0.5f;
r_out[2] = (v0[2] + v1[2]) * 0.5f;
}
除了r_out,这个函数是const,有没有办法将参数标记为返回值,否则将函数视为const?
见: https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Function-Attributes.html
【问题讨论】: