char *strcat(), *strcpy(), *fgets();
John Myers
jgm at k.gp.cs.cmu.edu
Fri Jun 24 06:05:52 AEST 1988
In article <2029 at pt.cs.cmu.edu> jgk at speech2.cs.cmu.edu (Joe Keane) writes:
>To be useful, strcpy and strcat should return the end of the new
>string.
While returning the end of the new string would be more useful than
the current specification, returning the first argumen *is* actually
useful. One of my standard macros goes something like:
#define SAVESTR(s) (strcpy(malloc(strlen(s)+1),(s)))
The semantics of strcpy(), etc. have already been cast in stone--
changing them now would break current correctly-written programs.
X3J11 is not in the business of making gratuitous incompatible changes
to C. Perhaps gratuitous or incompatible, but not both.
>[...] I already have a function like this, i just
>don't call it strcpy.
...which is of course the right thing to do.
--
_.John G. Myers Internet: John.Myers at cs.cmu.edu
LoseNet: ...!seismo!inhp4!wiscvm.wisc.edu!k!nobody
"The world is full of bozos. Some of them even have PhD's in Computer Science"
More information about the Comp.std.c
mailing list