Compiler optimization of references
Posted
by Phineas
on Stack Overflow
See other posts from Stack Overflow
or by Phineas
Published on 2010-03-29T07:11:51Z
Indexed on
2010/03/29
7:53 UTC
Read the original article
Hit count: 438
c++
I often use references to simplify the appearance of code:
vec3f& vertex = _vertices[index];
// Calculate the vertex position
vertex[0] = startx + col * colWidth;
vertex[1] = starty + row * rowWidth;
vertex[2] = 0.0f;
Will compilers recognize and optimize this so it is essentially the following?
_vertices[index][0] = startx + col * colWidth;
_vertices[index][1] = starty + row * rowWidth;
_vertices[index][2] = 0.0f;
© Stack Overflow or respective owner