On Mon, Dec 10, 2012 at 5:23 PM, Peter Stuge <pe...@stuge.se> wrote:

> Peter Stuge wrote:
> > Are there considerations (timing? something else?)
> > related to asking Windows for memory as needed
>
> Pete Batard wrote:
> > Adding and testing array reallocation code is a PITA
> > and development time is always super-limited
>


Ah, the luxuries of C++ :)

#include <vector>

Orin,
hasn't written array reallocation code in years.

OK, so it's not that hard...

size_t newsize = (oldsize * 3)/2; /* 0.5 of old size is _a_ generally
accepted increment; not saying it's the best in this case */
whatever *newarray = (whatever *)malloc(newsize*sizeof(whatever));
memcpy(newarray, oldarray, oldsize*sizeof(whatever));
whatever *temp = oldarray;
oldarray = newarray;
oldsize = newsize;
free(temp);
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to