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


Robert Dewar <dewar@gnat.com> writes:

| > Nevertheless, the comment isn't quite right, isn't it?  I was thinking of
| > the example "p1=malloc(n);free(p1);p2=malloc(n)" in which p1 == p2 is
| > possible even though they do not alias.
| 
| But after the free, p1 has an undefined value, and indeed the comparison
| p1==p2 is undefined at that point, so it is certainly not something the
| compiler has to worry about.

That is true.

The specification of realloc does not say the pointer is free()ed.

-- Gaby
 


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