4 ms·
I’m guessing v4 C didn’t have structs yet (v6 C does, but struct members are actually in the global namespace and are basically just sugar for offset and a type
by formerly_proven 10mo ago
I’m guessing v4 C didn’t have structs yet (v6 C does, but struct members are actually in the global namespace and are basically just sugar for offset and a type cast; member access even worked on literals. That’s why structs from early unix APIs have prefixed member names, like st_mode.
- Boltgolt 10mo ago)
- jacquesm 10mo agoHeh. I had the same impulse but then didn't do it, upon refreshing the page your comment was there :)
- topspin 10mo ago> I’m guessing v4 C didn’t have structs yet There may have been a early C without structs (B had none,) but according to Ken Thompson, the addition of structs to C was an important change, and a reason why his third attempt rewrite UNIX from assembly to a portable language finally succeeded. Certainly by the time the recently recovered v4 tape was made, C had structs: ~/unix_v4$ cat usr/sys/proc.h struct proc { char p_stat; char p_flag; char p_pri; char p_sig; char p_null; char p_time; int p_ttyp; int p_pid; int p_ppid; int p_addr; int p_size; int p_wchan; int *p_textp; } proc[NPROC]; /* stat codes */ #define SSLEEP 1 #define SWAIT 2 #define SRUN 3 #define SIDL 4 #define SZOMB 5 /* flag codes */ #define SLOAD 01 #define SSYS 02 #define SLOCK 04 #define SSWAP 010