Hi, > So my questions is: > is gcc *smart* enough that she can determine when to do the optimization? Yes. GCC can do the optimization when the optimizer has sufficient information to be certain that there are no side effects. GCC can not do the optimization when there is a black-box routine involved. Although there may be some aspects outside of the black-box routine that may be optimized. There is another compiler, LLVM, that does holistic optimizations. If I recall correct, there is an effort to add (or perhaps merely to investigate adding) holistic optimizations into GCC. --Eljay