Frustrated trying to be portable

Rahul Dhesi dhesi%cirrusl at oliveb.ATC.olivetti.com
Fri Feb 22 06:09:58 AEST 1991


In <1991Feb20.175318.28496 at zoo.toronto.edu> henry at zoo.toronto.edu
(Henry Spencer) writes:

     It is not possible to implement memmove(), in particular, in
     portable C.

This is unfortunately true.  My portable solution, is to assume that
the caller of memmove() always knows the direction of the move.   The
caller should therefore call either move_down() or move_up(), making
the same sort of decision about direction of the move that memmove()
would make anyway.  And move_down() and move_up() *can* be portably
implemented.  Lazy ANSI-conformant implementors can still do:

     #define move_down   memmove
     #define move_up     memmove
--
Rahul Dhesi <dhesi%cirrusl at oliveb.ATC.olivetti.com>
UUCP:  oliveb!cirrusl!dhesi



More information about the Comp.std.c mailing list