From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: tuhs-bounces@minnie.tuhs.org X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.1 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id c81b5de4 for ; Thu, 23 Aug 2018 22:48:55 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 3ECE2A1A87; Fri, 24 Aug 2018 08:48:54 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 633B0A1A1A; Fri, 24 Aug 2018 08:48:42 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (1024-bit key; unprotected) header.d=ccc.com header.i=@ccc.com header.b=d6jrVot+; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id CEA6FA1A1A; Fri, 24 Aug 2018 08:48:40 +1000 (AEST) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com [209.85.223.180]) by minnie.tuhs.org (Postfix) with ESMTPS id 5811EA1A19 for ; Fri, 24 Aug 2018 08:48:40 +1000 (AEST) Received: by mail-io0-f180.google.com with SMTP id q5-v6so2431408iop.3 for ; Thu, 23 Aug 2018 15:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccc.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5tRrjL9e9X3Wxhfmpy3hubItpyLvuhaJ0vzY8qC5RtE=; b=d6jrVot+wzsQvRAVfs2qk3ZiDqtjOOCaKUd2hV3d1M+0lkNKs694dOzvA0C0k9plV3 /IGFUE86armWLY8p8Z8HAAg2XBtkePSsIF5YT/S0B9tX5uxJ7ZIu9hVbf+/gep31P1+g EFmrok+RCj6B4cdGJRyu+IC/gV9RAy9AXiii8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5tRrjL9e9X3Wxhfmpy3hubItpyLvuhaJ0vzY8qC5RtE=; b=LX0XVVZNtWp14Np6L8mE85TezonemfGTz85e6UrqLFiRUnOhv1hOQJZcdmF1ae7hcW yx5Cz5RzgyaXzfTkgrZYi7ES4c19zLtmLkahNotBfe0OLMCkO82k8V2qzfYexsGvgPCh cS2HyKY0UspkTP8A3fGZqBHEBQ7EQzFDfqr0+XYn3wFfiuO3vxqPG3M+fzoaOkgv0/mg 4eE8v5GqcFQ4Yq/uX1B0WrCCJU6YVaqnSSd3xl1mlY1dLxBZsZKP/LrTbPa1yXM+zz5g Il8Ae36AImpRd9c5OJyvKcKUJguTuoWoiAfxeUJ0D16FKCeTTHqzgwBROriXU+ib8MVn vKFA== X-Gm-Message-State: APzg51AS5f/2GmnjCyQD4aIXqdOpiyUH2bXtBtpiXWkJvIBwDZ4hKIvg BC+tCgxcbTYqc1sWD+lmIsWCfpOMkMWs0LWhhh0uC5VFE88= X-Google-Smtp-Source: ANB0VdaSVpMF+k5WoMvBFMvxdWOIxh8+VBF/PQD221YIe7IBOdjXUrbFsuju5/poD0KX8Q8N4jSQSGlInHN/hgYZzs0= X-Received: by 2002:a6b:9cc9:: with SMTP id f192-v6mr16009260ioe.284.1535064519715; Thu, 23 Aug 2018 15:48:39 -0700 (PDT) MIME-Version: 1.0 References: <10c401d43aef$8be34870$a3a9d950$@ronnatalie.com> <151301d43b2f$07881ed0$16985c70$@ronnatalie.com> In-Reply-To: From: Clem Cole Date: Thu, 23 Aug 2018 18:48:13 -0400 Message-ID: To: Nevin Liber Content-Type: multipart/alternative; boundary="00000000000067c26f0574220f80" Subject: Re: [TUHS] C++ / Kernel X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: TUHS main list Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --00000000000067c26f0574220f80 Content-Type: text/plain; charset="UTF-8" On Thu, Aug 23, 2018 at 6:29 PM Nevin Liber 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 */ }; ... --00000000000067c26f0574220f80 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Thu, Aug 23, 2018 at 6:29 PM Nevin Liber <= nevin@eviloverlord.com> wr= ote:
It was= still kinda frowned upon in K&R1: =C2=A0"It is the responsibility= of the programmer to keep track of what type is currently stored in a=C2= =A0union; the re= sults are machine dependent if something is stored as one type and extracte= d as another."

= No.=C2=A0 It was not frowned upon, it was widely us= ed.=C2=A0 The message was just just Dennis and Brian giving you fair warnin= g. Remember K&R1 came out approx the same time as 7th edition [I saw th= e proofs for the book with UNIX/TS which was a little earlier, but pretty m= uch the same kernel].

From V7th editions buf.h (which I = show a date of May 5, 1979) and Ron is correct void*,=C2=A0caddr_t, d= addr_t,=C2= =A0= dev_t=C2=A0and the like; were all 7th edition-isms that BSD picked up= )
...
struct buf
{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 int=C2=A0 =C2=A0 =C2=A0b_flags;=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* see defines below *= /
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct=C2=A0 b= uf *b_forw;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* headed by d_tab of = conf.c */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct= =C2=A0 buf *b_back;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*=C2=A0 "= ;=C2=A0 */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 str= uct=C2=A0 buf *av_forw;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* position= on free list, */
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 struct=C2=A0 buf *av_back;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/*= =C2=A0 =C2=A0 =C2=A0if not BUSY*/
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 dev_t=C2=A0 =C2=A0b_dev;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* major+minor device name */
<= div class=3D"gmail_default" style=3D"">=C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned b_bcount;=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* transfer count */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 union {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 caddr_t b_addr;=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* low order core address */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int *b_= words;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* words for c= learing */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 struct filsys *b_filsys;=C2=A0 =C2=A0 /* superblocks */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct din= ode *b_dino;=C2=A0 =C2=A0 =C2=A0 /* ilist */ls -l buf.h
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 daddr_t *b_daddr;=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* indirect block */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 } b_un;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 daddr_t b_blkno;=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* block # on device */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 char=C2=A0 =C2=A0 b_xmem;=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* high order core a= ddress */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 char= =C2=A0 =C2=A0 b_error;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 /* returned after I/O */
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 unsigned int b_resid;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0/* words not transferred after error */
};
...
<= /div> --00000000000067c26f0574220f80--