This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
Gabriel Dos Reis wrote:
Can we be back to what we want to document
for malloc as the title of thi thread implies?
Surely you mean realloc? I don't see any discussion of
malloc per se here. I definitely think that in the case
of malloc, we should take the viewpoint that if a pointer
has been freed, any reference to it is plain wrong.
For realloc, how can we make a sensible decision if
we don't know the performance impact. I (and others
in this thread) guess that the performance impact
would be negligible, and if this is the case, then
surely it makes no sense to risk discombobulating
even one program for no significant gain.
If on the other hand, the gain is noticeable (hard
to believe), the balancing discussion is tricker. It
would be nice to be able to easily measure the impact
of decisions like this.
Of course we can't fully measure the impact, since as
people will rush to say, we have not fully taken
advantage of aliasing information yet. Still a
measurement of the current impact would be useful.