[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10070: bytevector-copy! overlapping behavior is not specified

From: Dmitry Chestnykh
Subject: bug#10070: bytevector-copy! overlapping behavior is not specified
Date: Thu, 17 Nov 2011 23:40:03 +0100


Documentation for bytevector-copy! doesn't specify whether source and
target may overlap (or the order of copying), it only says:

    "Copy len bytes from source into target, starting reading from
    source-start (a positive index within source) and start writing
    at target-start."

R6RS specifies this:

   "This must work even if the memory regions for the source and the
   target overlap, i.e., the bytes at the target location after the
   copy must be equal to the bytes at the source location before the

Looking at the code in bytevectors.c I see that the function uses
memcpy() instead of memmove(). Am I correct that in the current Guile
implementation, bytevectors must not overlap, that is, the effect of

   (bytevector-copy! source i1 source i2 len)

depends on the implementation of memcpy() in libc, and may behave
differently on different platforms?


1. Specify behavior of bytevector-copy! in the documentation.
2. If the current implementation is not correct, fix this ;-)

Thank you!

Dmitry Chestnykh

reply via email to

[Prev in Thread] Current Thread [Next in Thread]