Is realloc good form ?
- From: "Guillaume Dargaud" <use_the_form_on_my_contact_page@xxxxxxxxxxxxxxxx>
- Date: Thu, 18 Oct 2007 11:02:21 +0200
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=NULL;
Transformed=realloc(Transformed, Size*sizeof(double));
// 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
http://www.gdargaud.net/
.
- Follow-Ups:
- Re: Is realloc good form ?
- From: Kenneth Brody
- Re: Is realloc good form ?
- From: christian.bau
- Re: Is realloc good form ?
- Prev by Date: static library and dynamic library
- Next by Date: Re: GCC compiler error
- Previous by thread: static library and dynamic library
- Next by thread: Re: Is realloc good form ?
- Index(es):
Relevant Pages
|
|