On Thu, 13 Sep 2001, Kjeld Borch Egevang wrote:
> I was trying to port SPEC CPU 2000 (benchmarks), and one of the tests
> failed. I boiled it down to the attached program. For performance reasons it
> could be perfectly valid not to use memset(), but I agree that the code
> looks a bit odd.
With a high optimization level and a constant size of the area to set
(you'd likely use sizeof here, which is constant) gcc will happily inline
a memset() yielding no worse performance but no bugs and better
readability. You may have no loop at all as the result. Check yourself!
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
|