tech-kern archive

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

Re: UVM typedef struct



Salut,

On Wed, Aug 12, 2009 at 07:21:37PM -0500, James Chacon wrote:
> >typedef struct {
> >     ...
> >     blubb_t blubbs[MAX_BLUBBS];
> >     ...
> >} bla_t;
> >
> >typedef struct {
> >     ...
> >     bla_t owner;
> >     ...
> >} blubb_t;
> 
> Typedefs have nothing to do with that. You cannot create structures
> like this in C since in this setup you need to know the size which
> you can't define up front.

Sorry, I forgot an asterisk; of course I meant

 bla_t *owner;

Anything else would be pointless.

If you want to do that with typedefs, you have to use the names of
the structs, which contradicts the idea that you don't need to know
what's behind the type.

Thus, typedefs should be considered as having defunct reasoning in
favor of them while bringing disadvantages for both readability and
understandability.

                                Tonnerre

Attachment: pgpjWPXdE4Glv.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index