You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Graham Leggett <mi...@sharp.fm> on 2005/01/19 10:57:11 UTC

Best practice: arrays of structures

Hi all,

What is the best practice for handling arrays of structures? Do you define
an array of pointers to structures, or just an array of structures? Or
does it matter?

In other words this:

    ps->dirconn = apr_array_make(p, 10, sizeof(struct dirconn_entry));

or this:

    ps->dirconn = apr_array_make(p, 10, sizeof(struct dirconn_entry *));

Regards,
Graham
--


Re: Best practice: arrays of structures

Posted by Ben Laurie <be...@algroup.co.uk>.
Graham Leggett wrote:
> Hi all,
> 
> What is the best practice for handling arrays of structures? Do you define
> an array of pointers to structures, or just an array of structures? Or
> does it matter?

Depends whether its sparse. For spares, the latter solution is better.

> 
> In other words this:
> 
>     ps->dirconn = apr_array_make(p, 10, sizeof(struct dirconn_entry));
> 
> or this:
> 
>     ps->dirconn = apr_array_make(p, 10, sizeof(struct dirconn_entry *));
> 
> Regards,
> Graham
> --
> 
> 


-- 
http://www.apache-ssl.org/ben.html       http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff