From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28380 invoked from network); 16 Dec 2022 03:16:41 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 16 Dec 2022 03:16:41 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 2D5254238C; Fri, 16 Dec 2022 13:16:07 +1000 (AEST) Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) by minnie.tuhs.org (Postfix) with ESMTPS id 9964D4236E for ; Fri, 16 Dec 2022 13:16:02 +1000 (AEST) Received: by mail-oi1-f169.google.com with SMTP id v82so937912oib.4 for ; Thu, 15 Dec 2022 19:16:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vmC3gDSaZu7ftvV3OtdDMwBGRsmRIkQdcINe8synoKc=; b=TyajZlnRA4ynMmJCXsJCezJ8yhntm9LLMh89+l8/HncQ3hIN/1A2++zeD8WTiEB+1Q xLAYUqdEWlx54G7KuZ2NU7cxGfFNQRWMQij9TatXxScHRaj0daAcbKKvwkng/jy3VUG9 jCvt0+JucsUr0Li1G3Z7d3yCkAyHXI7JV4C2YE3l0tuP80J55fTPBkLKCq/NCTsMluIa WrHfTLU4uY380XXZF1DhoAKsMAT88Ifk+7dg03iL8wxeKQBYAbgSfIcbaIYqwh4kzlUd zo6cfrnKPLlFDqe/+p7owAcQ8okT7F9uKBHdB04dIFZvaBE3nLezcBKNuaw5m7LDIrjW Hpfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vmC3gDSaZu7ftvV3OtdDMwBGRsmRIkQdcINe8synoKc=; b=1cfh8VZrhFR+ILbTe5Nw5E4IphjKRLNzxoWQu78WChZPgdvecUJ1L3LlNFQwCXCcGn 8I34Gj8BrxLevTYZSImdjq1vmH/1CR6VGalacRbH03Lpzm6Bq8MbHHFyP1ycFdUslJJ/ Zs/b7m12UHNSQ1W/dZLdq+w5uXfmDEP3D29E7DQ8JTtBbRJ243C7G3uGBYfAvLbd6SEI SaaHQwgu7DUa5xJ/oW2ky3ggQvSa9DwrFKoYpagyWW64k+XfJBNjLKmnKLoNRk0GfvCH QuxkNAVIYsJdTdgZkj1ZGXl7ZuPXC8NR1YsLQPyPbqp0WiEnrQsgOgNJgCqo91BYls1j qv1A== X-Gm-Message-State: ANoB5plK3tAbtRLkRXUou4Ma2nBQ1L+hpq2XKWYEwNFx6YucnXywF4t7 kFEjPEeTJdG/6uN/lCHou19fnKh8iF3y/NmWm8E= X-Google-Smtp-Source: AA0mqf7pX3htmodT6j3jrptjFY1Q4Rp85ElnhDQrI4HOp2eupNg/NA+jwRXtxJR1WhaOrZBx8fTckxWFJYjQ4IucxII= X-Received: by 2002:a05:6808:1a28:b0:359:d035:e81f with SMTP id bk40-20020a0568081a2800b00359d035e81fmr388553oib.78.1671160501987; Thu, 15 Dec 2022 19:15:01 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ken Thompson Date: Thu, 15 Dec 2022 19:14:50 -0800 Message-ID: To: Douglas McIlroy Content-Type: multipart/alternative; boundary="000000000000156f8d05efe96074" Message-ID-Hash: JAVAOPUBZJGSHHBHPFFRHWU5LK3TMJAQ X-Message-ID-Hash: JAVAOPUBZJGSHHBHPFFRHWU5LK3TMJAQ X-MailFrom: kenbob@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Alejandro Colomar , TUHS main list X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: origin of null-terminated strings List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --000000000000156f8d05efe96074 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable asciz -- this is the first time i heard of it. doug -- yes. On Thu, Dec 15, 2022 at 7:04 PM Douglas McIlroy < douglas.mcilroy@dartmouth.edu> wrote: > I think this cited quote from > https://www.joelonsoftware.com/2001/12/11/ is urban legend. > > Why do C strings [have a terminating NUl]? It=E2=80=99s because the P= DP-7 > microprocessor, on which UNIX and the C programming language were > invented, had an ASCIZ string type. ASCIZ meant =E2=80=9CASCII with a Z (= zero) > at the end.=E2=80=9D > > This assertion seems unlikely since neither C nor the library string > functions existed on the PDP-7. In fact the "terminating character" of > a string in the PDP-7 language B was the pair '*e'. A string was a > sequence of words, packed two characters per word. For odd-length > strings half of the final one-character word was effectively > NUL-padded as described below. > > One might trace null termination to the original (1965) proposal for > ASCII, https://dl.acm.org/doi/10.1145/363831.363839. There the only > role specifically suggested for NUL is to "serve to accomplish time > fill or media fill." With character-addressable hardware (not the > PDP-7), it is only a small step from using NUL as terminal padding to > the convention of null termination in all cases. > > Ken would probably know for sure whether there's any truth in the > attribution to ASCIZ. > > Doug > --000000000000156f8d05efe96074 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
asciz -- this is the first time i heard of it.
doug --= yes.


On Thu, Dec 15, 2022 at 7:04 PM Douglas McIlroy &= lt;douglas.mcilroy@dartmou= th.edu> wrote:
I think this cited quote from
https://www.joelonsoftware.com/2001/12/11/ is urban le= gend.

=C2=A0 =C2=A0 Why do C strings [have a terminating NUl]? It=E2=80=99s becau= se the PDP-7
microprocessor, on which UNIX and the C programming language were
invented, had an ASCIZ string type. ASCIZ meant =E2=80=9CASCII with a Z (ze= ro)
at the end.=E2=80=9D

This assertion seems unlikely since neither C nor the library string
functions existed on the PDP-7. In fact the "terminating character&quo= t; of
a string in the PDP-7 language B was the pair '*e'. A string was a<= br> sequence of words, packed two characters per word. For odd-length
strings half of the final one-character word was effectively
NUL-padded as described below.

One might trace null termination to the original (1965) proposal for
ASCII,=C2=A0 https://dl.acm.org/doi/10.1145/363831.363= 839. There the only
role specifically suggested for NUL is to "serve to accomplish time fill or media fill." With character-addressable hardware (not the
PDP-7), it is only a small step from using NUL as terminal padding to
the convention of null termination in all cases.

Ken would probably know for sure whether there's any=C2=A0 truth in the=
attribution to ASCIZ.

Doug
--000000000000156f8d05efe96074--