From owner-freebsd-current@FreeBSD.ORG Wed Jan 28 12:12:02 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CA011065AA8 for ; Wed, 28 Jan 2009 12:12:02 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id 36D468FC12 for ; Wed, 28 Jan 2009 12:12:02 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id C75DE73098; Wed, 28 Jan 2009 13:17:34 +0100 (CET) Date: Wed, 28 Jan 2009 13:17:34 +0100 From: Luigi Rizzo To: Christoph Mallon Message-ID: <20090128121734.GA64348@onelab2.iet.unipi.it> References: <20090127132102.GA21574@onelab2.iet.unipi.it> <497F91C3.7040502@gmx.de> <20090127232103.GA40501@onelab2.iet.unipi.it> <498045E0.3050405@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <498045E0.3050405@gmx.de> User-Agent: Mutt/1.4.2.3i Cc: current@freebsd.org Subject: Re: duplicate typedefs and system headers ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2009 12:12:10 -0000 On Wed, Jan 28, 2009 at 12:47:44PM +0100, Christoph Mallon wrote: ... > >Would this be better/more compliant with standards -- i.e., > >is the following code correct ? gcc seems to have no objections. > > > > struct foo; > > int a(struct foo *); > > typedef struct foo bar; > > int a(bar *x) { ... } > > What is the problem with just including the correct header? This would > be The Right Thing(tm). Everything else is just an ugly hack. In this context I only need to know that a typedef (or struct) with that name exists, not its internals. The "correct header" defines the actual structure and has tons of other dependencies which make the code harder to read, maintain and compile. Again, if I had a chance to fix the underlying header(s) I would do, but at least right now I don't have such a possibility. cheers luigi