On 8/15/2006 at 1:25 PM Kevin Handy wrote:
Never trust an optimization unless you see it for
yourself.
Well, one might expand this to "never trust a compiler unless you can see
the code for yourself". At some point, we need to demand that a compiler
generate correct code. I will grant that writing a good bug-free optimizer
is not easy, but it's been done.
Microsoft C (16 bit) generates identical code for both the loop and the
memset() call--an inline "rep stosw"; Microsoft 32-bit C generates the same
code also--a "rep stosd" for both.
Cheers,
Chuck