H&S III strcat() wrong?

Norman Diamond diamond at jit345.swstokyo.dec.com
Wed Mar 20 10:40:13 AEST 1991


In article <5075771f.20b6d at apollo.HP.COM> vinoski at 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 at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.



More information about the Comp.std.c mailing list