memcpy

Larry Jones scjones at thor.UUCP
Fri Sep 21 23:19:29 AEST 1990


In article <1990Sep19.021418.11574 at maths.tcd.ie>, tim at maths.tcd.ie (Timothy Murphy) writes:
> Recently, while debugging the Unix version of unzip.c,
> I found a surprising discrepancy between 'memcpy' on various machines.
> 
> In unzip.c it is assumed that the effect of
> 	buf[0] = c;
> 	memcpy(buf+1, buf, 20);
> is to set
> 	buf[0] = buf[1] = buf[2] = ... = buf[21] = c.

This is a bug in unzip which is why almost every system required using
the version of memcpy that came with unzip instead of the one in the
standard library.  It has been fixed.  Note that unzip is inusual in
that it wants the DESCTRUCTIVE effect when the areas overlap where most
code wants the NON-DESCTRUCTIVE effect.
----
Larry Jones                         UUCP: uunet!sdrc!thor!scjones
SDRC                                      scjones at thor.UUCP
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150-2789             AT&T: (513) 576-2070
Life's a lot more fun when you're not responsible for your actions. -- Calvin



More information about the Comp.std.c mailing list