The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] origin of null-terminated strings
@ 2022-12-16  3:02 Douglas McIlroy
  2022-12-16  3:14 ` [TUHS] " Ken Thompson
                   ` (3 more replies)
  0 siblings, 4 replies; 28+ messages in thread
From: Douglas McIlroy @ 2022-12-16  3:02 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: TUHS main list

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’s because the PDP-7
microprocessor, on which UNIX and the C programming language were
invented, had an ASCIZ string type. ASCIZ meant “ASCII with a Z (zero)
at the end.”

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

^ permalink raw reply	[flat|nested] 28+ messages in thread
* [TUHS] Re: origin of null-terminated strings
@ 2022-12-16 22:26 Douglas McIlroy
  2022-12-17  2:03 ` James Frew
                   ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Douglas McIlroy @ 2022-12-16 22:26 UTC (permalink / raw)
  To: TUHS main list

> To what extent were the Unix folks at Bell Labs already familiar with DEC systems before the PDP-7?

Some awareness, but no hands-on experience,

> was any thought given to trying to get a 360 system?

Very serious thought. However, virtual memory was a non-negotiable
desideratum, to which Gene Amdahl was implacably opposed because
demand paging would devastate hardware performance. Soon after GE got
the nod, IBM revealed Gerrit Blaauw's skunk-works project, the 360/67,
but by then the die had been cast. Michigan bought one and built a
nice time-sharing system that was running well before Multics.

Doug

^ permalink raw reply	[flat|nested] 28+ messages in thread
* [TUHS] Re: origin of null-terminated strings
@ 2022-12-16 23:11 Noel Chiappa
  0 siblings, 0 replies; 28+ messages in thread
From: Noel Chiappa @ 2022-12-16 23:11 UTC (permalink / raw)
  To: tuhs; +Cc: jnc

    > From: Bob Supnik

    > The PDP11 had .ASCIZ, starting with Macro11 in 1972.

I was just about to report on my results, after a tiny bit of digging, which
included this. The important datum is that PAL-11 (in DEC-11-GGPB-D, "paper
tape software", April 1970, revised March 1971), which _preceded_ Macro-11,
_does not_ include .ASCIZ (although it has .ASCII). My oldest Macro-11 book
(DEC-11-OMACA-B-D, "BATCH-11/DOS-11 Assembler (MACRO-11)", April 1972, revised
March 1973) does have .ASCIZ. So in the DEC PDP-11 universe, it dates from
sometime between 1970 and 1972.

I'm not sure if Bell had any of the DEC paper tape software: "In early 1970 we
proposed acquisition of a PDP-11, which had just been introduced by
Digital. ... an order for a PDP-11 was placed in May. The processor arrived at
the end of the summer, but the PDP-11 was so new a product that no disk was
available until December. In the meantime, a rudimentary, core-only version of
Unix was written using a cross-assembler on the PDP-7." So the .ASCIZ in
Macro-11 wasn't until a couple of years later.

	 Noel

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2022-12-19  4:28 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16  3:02 [TUHS] origin of null-terminated strings Douglas McIlroy
2022-12-16  3:14 ` [TUHS] " Ken Thompson
2022-12-16  9:13   ` Dr Iain Maoileoin
2022-12-16 13:42     ` Dan Halbert
2022-12-16 16:10       ` Dan Cross
2022-12-16 16:22         ` Tom Lyon
2022-12-16 16:29         ` Jon Steinhart
2022-12-16 20:12     ` Dave Horsfall
2022-12-16 21:02       ` Warner Losh
2022-12-16 21:13         ` Clem Cole
2022-12-16 21:49           ` Clem Cole
2022-12-17  0:26             ` Phil Budne
2022-12-16 21:18         ` Luther Johnson
2022-12-16 21:20         ` Dan Halbert
2022-12-16  3:17 ` Steve Nickolas
2022-12-16 17:24 ` John P. Linderman
     [not found] ` <6009124d-750d-365e-a424-ec7bb25922b9@gmail.com>
2022-12-16 22:30   ` [TUHS] Terms for string, and similar character constructs (was: origin of null-terminated strings) Alejandro Colomar
2022-12-16 22:51     ` [TUHS] " Dave Horsfall
2022-12-16 22:26 [TUHS] Re: origin of null-terminated strings Douglas McIlroy
2022-12-17  2:03 ` James Frew
2022-12-17  3:42 ` steve jenkin
2022-12-17 17:11 ` Clem Cole
2022-12-17 18:15   ` Tom Lyon
2022-12-17 18:43     ` Clem Cole
2022-12-17 18:46       ` Clem Cole
2022-12-17 19:26     ` Tom Perrine
2022-12-19  4:26     ` Adam Thornton
2022-12-16 23:11 Noel Chiappa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).