On 1/25/07, Dennis Schridde <[EMAIL PROTECTED]> wrote:
> > I just don't know what else could be used. There are no dynamic arrays in
> > C, at least none that I know of. And I don't have another idea how
> > several dynamic-sized playlists could be handled. (I am lacking
> > experience and probably I didn't read my C book till the end.)
...
What I just thought about was some selfmade dynamic array:
struct Playlist { meta-info; Track[]; }
malloc( sizeof(meta-info) + sizeof(Track*) * playlistSize );
or realloc( ... );
Doesn't look nice, but would be an option...

Making dynamic arrays in C is not hard, but if you want a really nice
one, feel free to steal Freeciv's. It even has an iterator for easy
loops and you can define multiple types of dynamic arrays with a
separate namespace for the accessors of each... just what the doctor
ordered for the C++ addicts! ;-) All that in less than 150 lines.

See 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/specvec.h?rev=11261&view=auto

You get it for free today. Tomorrow the price will double ;-)

 - Per

_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to