Article View: comp.std.c
Article #2558Re: H&S III strcat() wrong?
From: Norman Diamond
Date: Wed, 20 Mar 1991 00:40
Date: Wed, 20 Mar 1991 00:40
22 lines
1542 bytes
1542 bytes
In article <5075771f.20b6d@apollo.HP.COM> vinoski@apollo.HP.COM (Stephen Vinoski) writes:
>... 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?
No.
>Does anybody actually proofread technical books before publishing them anymore?
Did they ever?
Part of the folklore is that examples should be tested before publishing.
It is a rare author who actually does so. I'm glad if you can get a refund.
--
Norman Diamond diamond@tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Technical Details
Message-ID:
<1991Mar20.004013.18442@tkou02.enet.dec.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!jit345!diamondReferences:
<5075771f.20b6d@apollo.HP.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!jit345!diamond From: diamond@jit345.swstokyo.dec.com (Norman Diamond) Newsgroups: comp.std.c,comp.misc Subject: Re: H&S III strcat() wrong? Message-ID: <1991Mar20.004013.18442@tkou02.enet.dec.com> Date: 20 Mar 91 00:40:13 GMT References: <5075771f.20b6d@apollo.HP.COM> Sender: news@tkou02.enet.dec.com (USENET News System) Reply-To: diamond@jit345.enet@tkou02.enet.dec.com (Norman Diamond) Followup-To: comp.misc Organization: Digital Equipment Corporation Japan , Tokyo Lines: 22