Joerg Schilling wrote:
> Previous versions of the POSIX standard made no limitations on strcpy()
> but the current standard claims that using strcpy() with overlapping 
> buffers gives undefined results.

It's not the official standard, but the copy I have of the O'Reilly POSIX
Programmer's Guide for POSIX 1.1-1990 says "The two strings may not overlap."

I do have a copy of the formal ANSI C89 standard, and it definitely says
"If copying takes place between objects that overlap, the behaviour is
 undefined."  (Sec. 7.11.2.3)

Seems like no portable software could ever assume that was safe behaviour.

-- 
        -Alan Coopersmith-           alan.coopersm...@sun.com
         Sun Microsystems, Inc. - X Window System Engineering

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to