From owner-freebsd-current Mon Oct 21 16:20:20 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA21772 for current-outgoing; Mon, 21 Oct 1996 16:20:20 -0700 (PDT) Received: from parkplace.cet.co.jp (parkplace.cet.co.jp [202.32.64.1]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id QAA21767 for ; Mon, 21 Oct 1996 16:20:17 -0700 (PDT) Received: from localhost (michaelh@localhost) by parkplace.cet.co.jp (8.8.0/CET-v2.1) with SMTP id XAA29157; Mon, 21 Oct 1996 23:20:06 GMT Date: Tue, 22 Oct 1996 08:20:06 +0900 (JST) From: Michael Hancock To: "Hr.Ladavac" cc: current@FreeBSD.org Subject: Re: In-Reply-To: <199610211147.AA020798458@ws2301.gud.siemens.co.at> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk On Mon, 21 Oct 1996, Hr.Ladavac wrote: > E-mail message from Michael Hancock contained: > > > > 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". > > I have some strong feelings about that: namely, a typedef should be used > for *any* type that is supposed to be opaque. > > If my program does not need to know whether something is a struct or a > scalar or whatever, it *must not* know it either. This tends to make > interface maintenance trivial (i.e. you have to recompile the interface > consumers, but you don't need to patch their sources as well). It's rare that a struct changes to anything but another struct. The only thing that isn't opaque about 'struct foo_tag' is the word struct. And the hint is more useful to most people who use C for writing kernels and similar systems than not. Please don't go typedef happy and put it everywhere you find an opportunity. It has important uses, but not in every case. I have a hard enough time as it is tracking names in the kernel. Regards, Mike Hancock