On Monday, 7 October '02, Hans Breuer wrote:
> At 18:50 07.10.02 +0200, Steffen Macke wrote:
>>Trying to compile, I get a lot
>>of "redefinition of ..." errors.
> Sorry for the incovenience. The M$ compiler docs claim this construct to
> be correct (there is no warning at all for the redefinition and at least
> for C++ this is standard conform :) See :
For ANSI C, declarator identifiers have to be unique (see K&R 2.ed p216 and
219). So it's a no-no.
>>Should the lines like
>>typedef struct _DiaRenderer DiaRenderer;
>>be replaced by matching #include statements?
> this would give the 'circular header dependencies', e.g. object.h
> needs to include diarenderer.h and vice versa, which I tried to
> avoid. IMO the best solution would be a dia-types.h file only
> to define the common typedef's something like
> #ifndef DIA_TYPES_H
> #define DIA_TYPES_H
> typedef struct _Layer Layer;
> typedef struct _DiagramData DiagramData;
> typedef struct _DiaRenderer DiaRenderer;
> This would allow to pass partly known 'class' pointers without
> exposing any details of the concrete class definitions.
> What do others think about this ?
There are several instances of circular includes because of structures
needing to know the size of types. Having a separate dia-types.h (or just
types.h) should get us rid of most, if not all, circularities.
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| HŚrdgrim of Numenor
"I do not agree with a word that you say, but I |----------------------------
will defend to the death your right to say it." | Where are we going, and
--Evelyn Beatrice Hall paraphrasing Voltaire | what's with the handbasket?