This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: Register group proposal
- To: ac131313 at cygnus dot com
- Subject: Re: Register group proposal
- From: Nick Duffek <nsd at redhat dot com>
- Date: Thu, 22 Feb 2001 11:45:30 -0500
- CC: gdb at sources dot redhat dot com, insight at sources dot redhat dot com
- References: <3A95369F.98027202@cygnus.com>
On 22-Feb-2001, Andrew Cagney wrote:
>Have a look at ui-out.h, ui-file.h, gdbarch.h, ... They have all used
>``struct foo *'' to implement an opaque type. In all cases it isn't
>possible to get to the inner workings.
I've noticed, and I've spent time scratching my head over why structs are
used in various places.
>Regarding typedefs. Per my e-mail
>http://sources.redhat.com/ml/gdb-patches/2001-02/msg00325.html it
>encouraging a tangled web of includes.
The example you quoted in that email:
Try declaring something like:
xyz.h:
struct xyz;
exter void xyz_foo (struct xyz *self, ...);
abc.h:
struct xyz;
struct abc;
extern abc_on_xyz (struct abc *self, struct xyz *on);
using typedefs. It ends up creating include spaghetti :-(
is very easy to declare using typedefs. Here's abc.h:
#include "xyz.h"
typedef struct {
int i;
} Abc;
extern int abc_on_xyz (Abc *self, Xyz *on);
Here's xyz.h:
typedef struct {
int j;
} Xyz;
extern void xyz_foo (Xyz *self);
Do we have an official policy prohibiting typedefs in include files?
Nick