From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Duffek To: ac131313@cygnus.com Cc: gdb@sources.redhat.com, insight@sources.redhat.com Subject: Re: Register group proposal Date: Thu, 22 Feb 2001 08:37:00 -0000 Message-id: <200102221645.f1MGjUu03076@rtl.cygnus.com> References: <3A95369F.98027202@cygnus.com> X-SW-Source: 2001-q1/msg00207.html 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