>>> while (*T++=*S++);
[compressed vertically -Mouse]
do { X = *S;
*T = X; S++; T++; } while('\0' != X);
The long version isn't less
efficient.
Actually, it is, or at least may be, depending on the compiler;
gcc compiles to the same assembly,
For some hardware, perhaps, for some particular version of gcc. (A
load/store architecture, perhaps?) Try it on something that has an
addressing mode which supports loading *S++ or storing *T++ as a single
operation. The VAX and the PDP-11 are examples. My memory of the 68k
is fuzzier, but I think it has such addressing modes too.
which is what I meant by "not less
efficient".
On that particular hardware with that particular compiler, it's no less
efficient. That doesn't mean much when we're discussing C per se.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse at
rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B