Cast became part of Typesetter C IIRC - so V6 and before does not support
casting and a number of other "modern" C features.
Again you need to think about the time. C, BLISS, PL/360 et al were being
developed to replace writing in raw assembler. So supporting assembler
style idioms that allowed you to get the raw addresses like PS or specific
registers were natural and also remember the optimizers are still in their
infancy.
i.e.
while (SOME_HW_REG_BASE_ADDR->some_sub-register&SOME_MASK) {
... do something/spin etc .. ...
}
would be a two assembler instruction loop and a natural type of thing a
programmer we want to do,
The idea of things like "const" etc we use today - just did yet exist
As side note from those times, the BLISS compiler's optimizer (which was
much more sophisticated than the C compilers) got so good that idioms that
test constants like that were removed as . So Wulf created "code
comments" (aka today's PRAGMAs) to inform the compiler that the writer of
the code knew what they were doing and to "just do it." If you look at CMU
kernel code from things like Hydra and other kernels of time - you will see
a the code comment: "BOH" - meaning "Buzz Off Hobbes" - the nasty shot
at
my friend Steve Hobbes. Bill student, who did much of the BLISS optimizer.
On Mon, Oct 27, 2014 at 9:40 AM, <random832(a)fastmail.us> wrote:
On Mon, Oct 27, 2014, at 09:34, Ronald Natalie wrote:
Yep, the kernel was littered with funky memory
constants using -> to
point at various registers. Probably the most ubuiqtous was
#define PS 0177776
struct {
int integ;
};
yielding the PS->integ access to the Processor Status Register.
Is there any reason this is superior to *(int *)0177776 [and e.g.
#define integ(x) (*(int *)(x))]? Did casting not exist back then?
_______________________________________________
TUHS mailing list
TUHS(a)minnie.tuhs.org
https://minnie.tuhs.org/mailman/listinfo/tuhs