Live data from Hacker News

Exploring pre-1990 versions of wc(1) (2023)

sigwait.org

1–10 of 27 posts

Re: Exploring pre-1990 versions of wc(1) (2023)

#4
post #3

> A word is a maximal string of characters delimited by spaces, tabs or newlines. And then the actual code explicitly filters out and ignores every character larger than 0x7F. Just why.

Because they thought that a word is something said in a human language that they can understand.

Re: Exploring pre-1990 versions of wc(1) (2023)

#5
post #3

> A word is a maximal string of characters delimited by spaces, tabs or newlines. And then the actual code explicitly filters out and ignores every character larger than 0x7F. Just why.

Because they thought that a word is something said in a human language that they can understand.

Mi ne pensas ke lingvoj kiuj usas ekskluzive la basan latinan alfabeton estas komprepeneblaj per si mem.

Re: Exploring pre-1990 versions of wc(1) (2023)

#7
post #6

A fun read on word count optimization can be found in Abrash's Black Book: https://www.jagregory.com/abrash-black-book/#lessons-learned... You can gloss over the asm if you wish, the tricks that are explained around it are worth it imho.

I wonder if large lookup tables/table-driven state machines are still as good as they used to be. After all, even with all the on-chip caches, the additional memory accesses today seem to be slower than doing some multi-instruction SIMD voodoo.

Re: Exploring pre-1990 versions of wc(1) (2023)

#8
post #3

> A word is a maximal string of characters delimited by spaces, tabs or newlines. And then the actual code explicitly filters out and ignores every character larger than 0x7F. Just why.

ASCII is 7 bits (the eight bit would be parity), so that makes perfect sense, in an ASCII world.

Re: Exploring pre-1990 versions of wc(1) (2023)

#9
post #3

> A word is a maximal string of characters delimited by spaces, tabs or newlines. And then the actual code explicitly filters out and ignores every character larger than 0x7F. Just why.

Probably because they're not characters. They're just bytes undefined by ASCII.
Post reply on HN