[TUHS] // comment in C++

Random832 random832 at fastmail.com
Fri Feb 10 00:37:34 AEST 2017


On Thu, Feb 9, 2017, at 07:26, Lars Brinkhoff wrote:
> Michael Kjörling <michael at kjorling.se> writes:
> > That wouldn't have anything to do with how ^@ is a somewhat common
> > representation of 000, would it? (Yes, using octal on purpose.) I've
> > always kind of wondered where that notation came from.  That ^A
> > through ^Z were representations of 001 through 032 makes more sense.
> 
> Look at two slices of the ASCII table:

And for where ^? for DEL comes from, (0377 + 0100) & 0377 == 0077 [where
the first 0377 is the control character of interest.] I am sure I've
seen code that calculates the character to be displayed in precisely
this way, but I can't remember where.

In fact, this is exactly how the control key worked on early terminals
(I recently had reason to look up an ASR-33 manual). The Shift key
toggled the 0020 bit (so shift-2 is " - if you look at the relevant
slice of an ASCII table), resulting in shift-K is [ (which did not have
a dedicated key) and shift-ctrl-K is ESC (which did have a dedicated key
as well, but the other non-letter control characters did not, and were
on shift-ctrl-LMNOP).

There was a mechanical lockout for keys that shift didn't make sense
with - all other letters and zero (which would otherwise have produced a
space), and one for ctrl (which locked out all the number and symbol
keys)


More information about the TUHS mailing list