【发布时间】:2014-04-01 02:28:43
【问题描述】:
在阅读 glibc 源代码时,我在 strcat.c 中发现了这个有趣的注释。 谁能解释这种优化是如何工作的?
/* Make S1 point before the next character, so we can increment
it while memory is read (wins on pipelined cpus). */
s1 -= 2;
do
{
c = *s2++;
*++s1 = c;
}
while (c != '\0');
【问题讨论】:
-
编译并转储它,这将揭示任何奇迹。 :D