Circular includes

From: Patrik Fimml <patrik_at_fimml.at>
Date: Sat, 28 Apr 2007 17:22:00 +0200

Hello,

I just discovered gob as a great thing hopefully simplifying my GObject
programming a lot. There's just one thing that seems awkward to me: the
__TYPEDEF_*__ approach to circular type dependencies. In hand-written
classes, I usually just put the typedefs before the includes—e.g.
instead of

        <begin %h code>
        #include "another-class.h"
        <end %h code>
        
        [...]
        
        #ifndef __TYPEDEF_A_CLASS__
        #define __TYPEDEF_A_CLASS__
        typedef struct _aClass aClass;
        #endif

I would suggest

        typedef struct _aClass aClass;
        
        <begin %h code>
        #include "another-class.h"
        <end %h code>
        
and circular includes would resolve comfortably. Is there a reason why
gob2 doesn't do it like that?

Kind regards,
Patrik

Received on Sat Apr 28 2007 - 08:42:43 CDT

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:05:02 CDT