Article View: comp.std.c
Article #2563H&S III strcat() wrong?
From: Stephen Vinoski
Date: Tue, 19 Mar 1991 14:57
Date: Tue, 19 Mar 1991 14:57
28 lines
1527 bytes
1527 bytes
I just received my copy of the 3rd edition of "C: A Reference Manual" by
Harbison and Steele. They state that the strcat() function can be implemented
as:
char *
strcat(char *s1, const char *s2)
{
s1 += strlen(s1);
strcpy(s1, s2);
return s1;
}
Since the return value does not point to the beginning of the original s1, is
this implementation standard-conforming?
(BTW, in the ~50 pages I read of H&S III last night, I found lots of blatant
typographical errors, some of them in the function prototypes for standard
library functions. I'm returning the book to Prentice-Hall and letting them
know that their quality needs heavy improvement. Does anybody actually
proofread technical books before publishing them anymore?)
-steve
| Steve Vinoski (508)256-0176 x5904 | Internet: vinoski@apollo.hp.com |
| HP Apollo Division, Chelmsford, MA 01824 | UUCP: ...!apollo!vinoski |
| "The price of knowledge is learning how little of it you yourself harbor." |
| - Tom Christiansen |
Technical Details
Message-ID:
<5075771f.20b6d@apollo.HP.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!apollo!vinoskiShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!apollo!vinoski From: vinoski@apollo.HP.COM (Stephen Vinoski) Newsgroups: comp.std.c Subject: H&S III strcat() wrong? Message-ID: <5075771f.20b6d@apollo.HP.COM> Date: 19 Mar 91 14:57:00 GMT Sender: root@apollo.HP.COM Organization: Hewlett-Packard Apollo Division - Chelmsford, MA Lines: 28