From owner-freebsd-current Mon Oct 21 08:20:23 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id IAA18057 for current-outgoing; Mon, 21 Oct 1996 08:20:23 -0700 (PDT) Received: from critter.tfs.com ([140.145.230.252]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id IAA18043; Mon, 21 Oct 1996 08:20:18 -0700 (PDT) Received: from critter.tfs.com (localhost.tfs.com [127.0.0.1]) by critter.tfs.com (8.7.5/8.7.3) with ESMTP id NAA01353; Mon, 21 Oct 1996 13:15:22 +0200 (MET DST) To: Michael Hancock cc: John Polstra , bde@zeta.org.au, current@FreeBSD.org, wollman@lcs.mit.edu Subject: Re: In-reply-to: Your message of "Mon, 21 Oct 1996 20:11:45 +0900." Date: Mon, 21 Oct 1996 13:15:22 +0200 Message-ID: <1351.845896522@critter.tfs.com> From: Poul-Henning Kamp Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk In message , Mich ael Hancock writes: I agree 100% with the footnote that if a "simple struct" represent a selfcontained object a typedef is OK too. >On Mon, 21 Oct 1996, Poul-Henning Kamp wrote: > >> >It's questionable to define a typedef just to save typing the word struct. >> >> The reason I do it is not to save 7 chars of typing. >> >> It's because we are talking about a self-contained type that carries >> with it all the operations you can perform on it. > >I think you should do the changes you mention to queue.h and change the >man page example to the following... > >*** foo1 Mon Oct 21 20:06:06 1996 >--- foo2 Mon Oct 21 20:05:33 1996 >*************** >*** 1,10 **** > #include > >! SLIST_HEAD(slisthead, entry) head; > struct slisthead *headp; /* Singly-linked List head. */ > struct entry { > int i; >! SLIST_ENTRY(entry) entries; /* Singly-linked List. */ > } *n1, *n2, *n3, *np; > > >--- 1,10 ---- > #include > >! SLIST_HEAD(slisthead, struct entry) head; > struct slisthead *headp; /* Singly-linked List head. */ > struct entry { > int i; >! SLIST_ENTRY(struct entry) entries; /* Singly-linked List. */ > } *n1, *n2, *n3, *np; > > >The original mixes up tag names and type names, which is a bogus thing to >do. > >Use typedefs for scalars such as dev_t and for complex objects that >combine arrays, pointers, structs, and functions. > >For simple structs, the typedef doesn't gain you much aside from not >having to type "struct". > >Regards, > > >Mike Hancock > > > -- Poul-Henning Kamp | phk@FreeBSD.ORG FreeBSD Core-team. http://www.freebsd.org/~phk | phk@login.dknet.dk Private mailbox. whois: [PHK] | phk@ref.tfs.com TRW Financial Systems, Inc. Future will arrive by its own means, progress not so.