Article View: comp.std.c
Article #5123Re: char *strcat(), *strcpy(), *fgets();
From: John Myers
Date: Thu, 23 Jun 1988 20:05
Date: Thu, 23 Jun 1988 20:05
23 lines
1437 bytes
1437 bytes
In article <2029@pt.cs.cmu.edu> jgk@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@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"
Technical Details
Message-ID:
<2030@pt.cs.cmu.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!bbn!rochester!pt.cs.cmu.edu!k.gp.cs.cmu.edu!jgmReferences:
<haddock.4604> <1719@ogcvax.ogc.edu> <1309@ark.cs.vu.nl> <2029@pt.cs.cmu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!bbn!rochester!pt.cs.cmu.edu!k.gp.cs.cmu.edu!jgm From: jgm@k.gp.cs.cmu.edu (John Myers) Newsgroups: comp.std.c Subject: Re: char *strcat(), *strcpy(), *fgets(); Message-ID: <2030@pt.cs.cmu.edu> Date: 23 Jun 88 20:05:52 GMT References: <haddock.4604> <1719@ogcvax.ogc.edu> <1309@ark.cs.vu.nl> <2029@pt.cs.cmu.edu> Sender: netnews@pt.cs.cmu.edu Organization: System/Technology Development Corp. Lines: 23