Back in the 80's, I learned Pascal, and learned about its dynamically allocated records, then I went on to learn C, and got used to its pointers and arrays. Then I went back to Pascal, and designed a program in my head with some dynamically allocated linked list data structures, and another data structure that had a member that pointed to the head of the linked list. Then I started typing in the Pascal code, and hit…
That must have been a very old Pascal Nowadays there is the @ operator
There was a trick for doing PEEK and POKE in Apple Pascal, using a union that contained a pointer to some type you could dereference to read and write, and also an integer so you could set the pointer. I had the hardest time understanding it, and just could not get my head around the "record case boolean of", but I just typed in the magic code with a bunch of weird ^'s and it worked somehow.
You can use type punning tricks with "union" to implement arbitrary unsafe pointer arithmetic in Pascal, since it lets you convert between pointers and integers.
https://en.wikipedia.org/wiki/Type_punning#Pascal
Here's an article about that trick, in German (which makes it sound even cooler):
https://www.robert-tolksdorf.de/book/Tolksdorf-UCSD-Pascal-C...
p. 63: 3.1 "PEEK" und "POKE" auch in Pascal
[...]
type byte = 0..255
spchrinhalt = packed array [0..0] of byte;
spchrstelle = record case boolean of
true: (adresse:integer); ( Zieger )
false: (inhalt:^spchrinhalt) ( Inhalt )
end;
procedure poke(adresse:integer; inhalt:byte);
var dummy:spchrstelle;
begin
dummy.adresse := adresse;
dummy.inhalt^[0] := inhalt;
end;
function peek(adresse:integer): byte;
var dummy:spchrstelle;
begin
dummy.adresse := adresse;
peek := dummy.inhalt^[0];
end;