The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: clemc@ccc.com (Clem Cole)
Subject: [TUHS] speaking of early C compilers
Date: Mon, 27 Oct 2014 10:04:30 -0400	[thread overview]
Message-ID: <CAC20D2PBFBNxQffi+uYxefNy-9VQG16QxE2UZmsqk9sRoKz7Lg@mail.gmail.com> (raw)
In-Reply-To: <1414417236.2834739.183752501.006CD61F@webmail.messagingengine.com>

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 at 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 at minnie.tuhs.org
> https://minnie.tuhs.org/mailman/listinfo/tuhs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20141027/c3bdd524/attachment.html>


  reply	other threads:[~2014-10-27 14:04 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 10:32 Jason Stevens
2014-10-27 13:03 ` Brantley Coile
2014-10-27 13:34   ` Ronald Natalie
2014-10-27 13:40     ` random832
2014-10-27 14:04       ` Clem Cole [this message]
2014-10-27 15:04       ` Dave Horsfall
2014-10-27 17:09 ` scj
2014-10-27 20:35   ` Ronald Natalie
2014-10-27 21:34     ` Clem Cole
2014-10-28  1:09       ` Dave Horsfall
2014-10-28  2:06         ` Clem Cole
2014-10-28 12:22           ` Ronald Natalie
2014-10-28 12:42             ` Clem Cole
2014-10-28 13:03               ` Ronald Natalie
2014-10-28 22:02                 ` John Cowan
2014-10-27 13:46 Noel Chiappa
2014-10-27 13:54 Jason Stevens
2014-10-27 14:48 Noel Chiappa
2014-10-27 15:09 ` Ronald Natalie
2014-10-27 15:13 ` Dave Horsfall
2014-10-27 16:52 ` Dan Cross
2014-10-27 15:48 Noel Chiappa
2014-10-27 16:25 ` Dave Horsfall
2014-10-28  0:16   ` John Cowan
2014-10-27 16:50 Norman Wilson
2014-10-27 18:16 Nelson H. F. Beebe
2014-10-28  1:55 Jason Stevens
2014-10-28 12:52 ` Ronald Natalie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAC20D2PBFBNxQffi+uYxefNy-9VQG16QxE2UZmsqk9sRoKz7Lg@mail.gmail.com \
    --to=clemc@ccc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).