unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#10070: bytevector-copy! overlapping behavior is not specified
@ 2011-11-17 22:40 Dmitry Chestnykh
  2011-11-20  0:12 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Chestnykh @ 2011-11-17 22:40 UTC (permalink / raw)
  To: 10070

Hello,

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
   copy."

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?

Proposal:

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

Thank you!

-- 
Dmitry Chestnykh
http://www.codingrobots.org





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-20  0:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-17 22:40 bug#10070: bytevector-copy! overlapping behavior is not specified Dmitry Chestnykh
2011-11-20  0:12 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).