From owner-freebsd-current Sun Oct 20 14:30:58 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA15754 for current-outgoing; Sun, 20 Oct 1996 14:30:58 -0700 (PDT) Received: from critter.tfs.com (disn20.cybercity.dk [194.16.57.20]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id OAA15745; Sun, 20 Oct 1996 14:30:44 -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 XAA24991; Sun, 20 Oct 1996 23:29:51 +0200 (MET DST) To: John Polstra cc: bde@zeta.org.au, current@FreeBSD.org, wollman@lcs.mit.edu Subject: Re: In-reply-to: Your message of "Sun, 20 Oct 1996 14:12:38 PDT." <199610202112.OAA04687@austin.polstra.com> Date: Sun, 20 Oct 1996 23:29:51 +0200 Message-ID: <24989.845846991@critter.tfs.com> From: Poul-Henning Kamp Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk In message <199610202112.OAA04687@austin.polstra.com>, John Polstra writes: >> >Don't do that, then. It's horrid style anyway (IMAO), and you >> >/certainly/ don't see any native Berkeley code doing that. The style >> >guide should discourage the practice if it doesn't already. I disagree. >> >> I agree. Typedef should only be used for scalar types and function >> types. > >Why do you say that? There's already precedent for using typedefs >for structs in, for example, the "DIR" type of . And it >is in line with C++ practice, where the struct, class, or union >keyword is almost never used outside of the declaration. This is actually why I do it. The code I'm crunching right now is pretty much C++ written in C, ie. object oriented. Not because I want to rewrite the kernel in C++ at a later date, but because it is the design model that fits this particular piece. My approach to fixing would probably be to add the new macros for each kind of queue, rather than have to change all the code that uses it now: #define SLIST_HEAD_TYPE(name, type) \ struct name { \ type *slh_first; /* first element */ \ } (_TYPE suffix is open for discussion) I would probably add the _EMPTY, _NEXT, _PREV, _FIRST and _LAST macros to all the queues as apropriate while I'm there. I consider it a major flaw in that you have to know anyting about the internal representation. -- 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.