strcpy wars, jeez! A proposed resolution.
Karl Heuer
karl at haddock.ISC.COM
Fri Apr 1 04:41:36 AEST 1988
In article <4215 at ihlpf.ATT.COM> nevin1 at ihlpf.UUCP (00704a-Liber,N.J.) writes:
>In article <6286 at dhw68k.cts.com> david at dhw68k.cts.com (David H. Wolfskill) writes:
>>The current dpANS also specifies "If copying takes place between objects
>>that overlap, the behavior is undefined." I would feel rather more
>>comfortable with changing that to read "... implementation defined."
>
>I would not! This would imply that a program which calls strcpy() with
>overlapping strings is 'correct', and this is simply not true.
But it would be true, if the standard were to explicitly allow it.
>If this were to change, all programs that use strcpy() would be suspect every
>time a new version of the compiler comes out
Only those programs that use strcpy on overlapping strings. And if the
"implementation-defined" part is properly phrased, strcpy(s,s+1) would be
guaranteed to be safe.
Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
More information about the Comp.lang.c
mailing list