The result is correct, even when both areas overlap.
This function is deprecated (marked as LEGACY in POSIX.1-2001): use
in new programs.
Note that the first two arguments
are interchanged for
POSIX.1-2008 removes the specification of