The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Clem Cole <clemc@ccc.com>
To: Nevin Liber <nevin@eviloverlord.com>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] C++ / Kernel
Date: Thu, 23 Aug 2018 18:48:13 -0400	[thread overview]
Message-ID: <CAC20D2Ogy0Nnvi+85EER7PWQKfD-aLRkfxgMCpSKmrE7vWekEw@mail.gmail.com> (raw)
In-Reply-To: <CAGg_6+PY70t3t4x2J7uapn9E1LodtGZhcqRavtM2ve89B97byg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]

On Thu, Aug 23, 2018 at 6:29 PM Nevin Liber <nevin@eviloverlord.com> wrote:

> It was still kinda frowned upon in K&R1:  "It is the responsibility of the
> programmer to keep track of what type is currently stored in a union; the
> results are machine dependent if something is stored as one type and
> extracted as another."
>

No.  It was not frowned upon, it was widely used.  The message was just
just Dennis and Brian giving you fair warning. Remember K&R1 came out
approx the same time as 7th edition [I saw the proofs for the book with
UNIX/TS which was a little earlier, but pretty much the same kernel].

From V7th editions buf.h (which I show a date of May 5, 1979) and Ron is
correct void*, caddr_t, daddr_t, dev_t and the like; were all 7th
edition-isms that BSD picked up)
...
struct buf
{
        int     b_flags;                /* see defines below */
        struct  buf *b_forw;            /* headed by d_tab of conf.c */
        struct  buf *b_back;            /*  "  */
        struct  buf *av_forw;           /* position on free list, */
        struct  buf *av_back;           /*     if not BUSY*/
        dev_t   b_dev;                  /* major+minor device name */
        unsigned b_bcount;              /* transfer count */
        union {
            caddr_t b_addr;             /* low order core address */
            int *b_words;               /* words for clearing */
            struct filsys *b_filsys;    /* superblocks */
            struct dinode *b_dino;      /* ilist */ls -l buf.h
            daddr_t *b_daddr;           /* indirect block */
        } b_un;
        daddr_t b_blkno;                /* block # on device */
        char    b_xmem;                 /* high order core address */
        char    b_error;                /* returned after I/O */
        unsigned int b_resid;           /* words not transferred after
error */
};
...

[-- Attachment #2: Type: text/html, Size: 5705 bytes --]

  reply	other threads:[~2018-08-23 22:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-23 14:42 ron
2018-08-23 17:24 ` Clem Cole
2018-08-23 20:21 ` Bakul Shah
2018-08-23 22:17   ` ron
2018-08-23 22:28     ` Nevin Liber
2018-08-23 22:48       ` Clem Cole [this message]
2018-08-23 23:14     ` Steffen Nurpmeso
2018-08-24 14:13       ` Steffen Nurpmeso
2018-08-24 14:32         ` ron
2018-08-24 18:15           ` Steffen Nurpmeso
2018-08-26 16:34             ` Paul Winalski
2018-08-27 16:31               ` Steffen Nurpmeso
2018-08-24  1:41     ` Bakul Shah
2018-08-24 10:41       ` Pete Turnbull
2018-08-24 12:17       ` ron
2018-08-24 18:36         ` Bakul Shah
2018-08-24 18:38           ` ron
2018-08-24  1:58     ` Dan Cross
2018-08-24  3:04       ` Clem cole
2018-08-24 14:01         ` Dan Cross
2018-08-24 13:22 ` Derek Fawcus
2018-08-24 16:59   ` Steffen Nurpmeso
2018-08-23 23:29 Noel Chiappa
2018-08-23 23:42 ` ron
2018-08-24  0:30   ` Clem Cole
2018-08-24  2:05     ` Bakul Shah
2018-08-24 12:21     ` ron
2018-08-24  1:27 Noel Chiappa
2018-08-24  2:52 ` Clem cole
2018-08-24  7:30 Paul Ruizendaal

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=CAC20D2Ogy0Nnvi+85EER7PWQKfD-aLRkfxgMCpSKmrE7vWekEw@mail.gmail.com \
    --to=clemc@ccc.com \
    --cc=nevin@eviloverlord.com \
    --cc=tuhs@minnie.tuhs.org \
    /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).