tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: UVM typedef struct



On Wed, 12 Aug 2009, Tonnerre LOMBARD wrote:
> I recently encountered a problem extending an api_t and have a
> question:
> 
>  - bla_t contains a list of references to blubb_t
>  - blubb_t contains a pointer back to bla_t
> 
> How would that ever work?

Do you mean "how could you declare such a thing?"

    /* in bla.h */
    typedef struct bla bla_t;
    #define BLUBBS_PER_BLA 8

    /* in blubb.h */
    typedef struct blubb blubb_t;

    /* in bla-private.h */
    #incude "bla.h"
    #incude "blubb.h"
    struct bla {
        blubb_t * blubblist[BLUBBS_PER_BLA];
    }

    /* in blubb-private.h */
    #incude "bla.h"
    #incude "blubb.h"
    struct blubb {
        bla_t * blaptr;
    }

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index