Init array to -1 with memset()?

Carson Gaspar carson at taltos.org
Tue Jan 27 17:47:28 GMT 2004


Why not (given char array a of size 100):

a[0] = -1;
memset((void *)&a[1], a[0], 99);

Or just pass a -1 to memset...

--On Tuesday, January 27, 2004 9:36 AM -0800 Wayne Davison 
<wayned at samba.org> wrote:

> The match.c code has a loop that initializes an array to -1.  I'm
> considering changing this to a memset() of 0xFF over all the array's
> bytes, but that depends on a system's representation of a -1 being "all
> bit on".  Should I be anal about this and add a configure check to make
> sure that we're not running on some weird system where this is not true?
> Or should I just let this be as it was?
>
> ..wayne..






More information about the rsync mailing list