String copy idiom.

Guy Harris guy at rlgvax.UUCP
Thu Mar 21 15:53:16 AEST 1985


> Beware of saying things like "the fastest possible".
> I found a better way for for any string longer than two characters.
> The following is from 4.2BSD on a VAX.

Geepers, didn't they teach you to use the "-O" option in school?  Running
your example through "cc" with the "-O" flag, I get the same code for
both examples except that the second "FAST" version has an extra test
at the beginning.

"-O" does a fair bit of code motion, especially when strange sequences
of jumps are involved; basically, it's covering PCC's tracks.



More information about the Comp.lang.c mailing list