noalias, again (was extern const)

Doug Gwyn gwyn at brl-smoke.ARPA
Sun Apr 3 12:19:24 AEST 1988


In article <7007 at ki4pv.uucp> tanner at ki4pv.uucp (Dr. T. Andrews) writes:
>I'd like to know whose intentions are specified in this "noalias"
>functionality.   Seems  like the original routine did the "right"
>thing, working for those fine people  wishing  to  shorten  their
>strings.

"noalias" has nothing to do with the fact that that has always been an
unsafe usage of strcpy().  Note that Chris looked up one VAX version
and found that it used a right-to-left copy machine instruction.
Unless the implementor decided to take special pains to make this
safe for string shortening, people who use it that way will get
results other than what they intended.

What about programmers who want to use strcpy() to make room in a
string to insert an extra character?  Don't tell me that they are
all wet while those who want to shorten strings are blessed.  The
plain truth is that generic strcpy() should not be used for either
purpose.  Sorry, but that's existing practice, folks.



More information about the Comp.lang.c mailing list