11/16/2008

Mystery remain, but I got the evidence I wanted.

In this post I wrote prior I mentioned my frustration of not being able to find the page that says whether vector<T>::size is inline or not. Well, I found it:

http://msdn.microsoft.com/en-us/library/bw1hbe6y.aspx

So if I remember right the size() function was implemented in the vector class definition. Assuming this is true, then according to the page above the size() function is indeed inline. However, chances are that the optimizer determines the size() function is better off to be none-inline.

So come back to the original question: Should I request my colleague to remove that line?

I guess I come to reach a conclusion in myself that it doesn't really matter. After all, the caching idea will most likely be done by the optimizer so what he has done doesn't really help. Raising tiny point like this is more like showing off knowledge toward language detail on the cost of being unnecessarily annoying. (Well, Mr. Anderson would probably do that and make people think he is tough and knows a lot). The most, and probably only, important thing is that I've found the piece of info I wanted to find, and that added little tiny happiness to my day.

沒有留言: