memcpy

Timothy Murphy tim at maths.tcd.ie
Wed Sep 19 12:14:18 AEST 1990


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 indeed the effect with most compilers I tried --
rather surprisingly, to me --
but not with cc on the Sun SparcStation (sun4).

Is this a bug on the Sparc,
or is memcpy not fully specified?

-- 

Timothy Murphy  

e-mail: tim at maths.tcd.ie



More information about the Comp.std.c mailing list