This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: malloc attributes and realloc


"Joseph S. Myers" <jsm@polyomino.org.uk> writes:

| > If there was simply *no* workaround, however, I would complain.  There
| > has to be a reasonable way to compare the two in the case in which you
| > really want to and you know what you're doing; and it shouldn't involve
| > ordering the compiler not to optimize.
| 
| Does anyone have any real code that does compare the old pointer with the
| return value of realloc (in any way, whether with direct comparison, as
| integers or as bit-patterns)?

Yes.  I mentionned implementations of C++'s std::vector-lik container
that use malloc+realloc to enable in-place expansion.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]