[comp.sys.hp] bcopy v.s. memcpy

jimp@cognos.UUCP (Jim Patterson) (05/26/91)

In article <JBW.91May24192706@bigbird.bu.edu> jbw@bigbird.bu.edu (Joe Wells) writes:
+>tml@tik.vtt.fi (Tor Lillqvist) writes:
+>   (using the b* and index functions even if ANSI C and POSIX mandate
+>   mem* and strchr)?

>bcopy guarantees correct overlapping moves.  memcpy does not.  When ANSI C
>or POSIX provide us with a function that is guaranteed to handle
>overlapping moves correctly, then you can justify your position.

They have. memmove is part of the ANSI C standard, and guarantees
proper handling of overlapping moves. I believe that it's part of
POSIX as well, since POSIX requires ANSI C.



-- 
Jim Patterson                              Cognos Incorporated
UUNET:uunet!cognos.uucp!jimp               P.O. BOX 9707    
BITNET:ccs.carleton.ca!cognos.uucp!jimp    3755 Riverside Drive
PHONE:(613)738-1440 x6112                  Ottawa, Ont  K1G 3Z4

gwc@root.co.uk (Geoff Clare) (05/31/91)

In <9674@cognos.UUCP> jimp@cognos.UUCP (Jim Patterson) writes:

>memmove is part of the ANSI C standard, and guarantees
>proper handling of overlapping moves. I believe that it's part of
>POSIX as well, since POSIX requires ANSI C.

No, POSIX.1 only requires selected parts of ANSI C, not the whole thing.

The mem*() functions are not required by POSIX.1.
-- 
Geoff Clare <gwc@root.co.uk>  (Dumb American mailers: ...!uunet!root.co.uk!gwc)
UniSoft Limited, London, England.   Tel: +44 71 729 3773   Fax: +44 71 729 3273