Hello all,
I have a 'good practice' question.
Lately I've been using a lot of functions such as this:
void Func(int Size, double *Array) {
static double *Transformed=NU LL;
Transformed=rea lloc(Transforme d, Size*sizeof(dou ble));
// Do something from Array to Transformed
}
Now if the value of Size changes a lot between calls, the resulting prog is
poorly optimized (it reallocates each time). I'm ok with that.
Ignoring the fact that the memory is never freed, if the value of Size
changes seldom, does the call to realloc wastes time then ?
--
Guillaume Dargaud
I have a 'good practice' question.
Lately I've been using a lot of functions such as this:
void Func(int Size, double *Array) {
static double *Transformed=NU LL;
Transformed=rea lloc(Transforme d, Size*sizeof(dou ble));
// Do something from Array to Transformed
}
Now if the value of Size changes a lot between calls, the resulting prog is
poorly optimized (it reallocates each time). I'm ok with that.
Ignoring the fact that the memory is never freed, if the value of Size
changes seldom, does the call to realloc wastes time then ?
--
Guillaume Dargaud
Comment