Subj : Re: BC5.02 STL question To : borland.public.cpp.borlandcpp From : Sebastian Ledesma Date : Mon May 31 2004 04:56 pm Ed: I used to think that modern compiler where more smart and: (always assuming integer math) ++i: -load, increment, use and store. i++ - load, use, increment and store. By using CPU register optimizations should be no difference (but not really sure about that). Saludos Sebastian "Ed Mulroy [TeamB]" escribió en el mensaje news:40bb7961$2@newsgroups.borland.com... > When used only to increment, no use of the value: > > ++i > increment and use the value > > i++ > load the value, > save a copy, > increment the value, > use the original value > > Post increment can call a copy constructor and may have other side > effects depending upon the details of the object involved. > > For an integer where the value is not used in the statement the > overhead is small but still bad compared to pre-increment. That is > probably why the compiler writers decided to make the optimizer detect > the situation and generate code for pre-increment. > .