I have a class cnVector that represents a point in 3 dimensional space. Its operators + - * / are used intensively.
Their implementation is very short:
cnVector cnVector::operator + (const cnVector& v) const { return cnVector( x + v.x, y + v.y, z + v.z ); } My question is, because this function is very short, should I inline it although its intensive use? or would it generate too much code when using it that much?
-finline-functionswill instruct it to automatically inline functions it thinks should be inlined.-finline-small-functionsas a basic optimization (i.e. under-O/-O1and higher).