Article View: comp.std.c
Article #1620Re: strncat is insufficient
From: Henry Spencer
Date: Sun, 26 Aug 1990 02:38
Date: Sun, 26 Aug 1990 02:38
17 lines
1193 bytes
1193 bytes
In article <620.26d6d0cd@iccgcc.decnet.ab.com> browns@iccgcc.decnet.ab.com (Stan Brown, Oak Road Systems) writes:
>Can Karl, or someone else who knows, explain why strncpy was standardized
>to copy n characters even at the expense of a zero byte...
Because that is the way strncpy() behaved in existing implementations,
and there was code that depended on it.
> or why no
>alternative that always terminates the string was provided...
Because there was no such alternative that had been implemented and used.
ANSI C standardized -- by and large -- an existing language. This is a
feature, not a bug.
--
Committees do harm merely by existing. | Henry Spencer at U of Toronto Zoology
-Freeman Dyson | henry@zoo.toronto.edu utzoo!henry
Technical Details
Message-ID:
<1990Aug26.023859.12298@zoo.toronto.edu>Path:
arc1-ca.pugleaf.net!utzoo!henryReferences:
<17418@haddock.ima.isc.com> <13598@smoke.BRL.MIL> <1990Aug23.132400.3654@zorch.SF-Bay.ORG> <587@array.UUCP> <620.26d6d0cd@iccgcc.decnet.ab.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: strncat is insufficient Message-ID: <1990Aug26.023859.12298@zoo.toronto.edu> Organization: U of Toronto Zoology References: <17418@haddock.ima.isc.com> <13598@smoke.BRL.MIL> <1990Aug23.132400.3654@zorch.SF-Bay.ORG> <587@array.UUCP> <620.26d6d0cd@iccgcc.decnet.ab.com> Date: Sun, 26 Aug 90 02:38:59 GMT