Subj : Re: BC5.02 STL question To : borland.public.cpp.borlandcpp From : Ed Mulroy [TeamB] Date : Mon May 31 2004 08:29 pm Of course it also depends upon the processor instruction set and how its pipelines and cache work. Assuming the variable is in memory and not in a register ++i inc [ebx] i++ mov eax,[ebx] inc eax mov [ebx],eax It has become common for people to use the wrong operator. I guess that is why the architects of the compiler decided to detect that a post-incremented integer isn't really used for its original value and optimize it to pre-increment. With most Pentium class processors that isn't too bad. However if you're doing something like I did in a small program not long ago, that difference is multiplied by 10 million per term and there were quite a few terms. In a more normal loop you would never notice the difference in overhead. In the situation where 'i' is a class item or '++' is an overloaded operator the differences can be great. .. Ed > Sebastian Ledesma wrote in message > news:40bb810f$1@newsgroups.borland.com... > > 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). .