This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
"Joseph S. Myers" wrote:
>
> On Thu, 1 Jan 2004, Bruce Korb wrote:
>
> > Even if what was addressed by 'p' is no longer valid, it is certainly
> > still valid to test to see if 'q' differs from 'p'.
>
> No; 6.2.4#2 says that "The value of a pointer becomes indeterminate when
> the object it points to reaches the end of its lifetime.";
That's nice. Were there a compiler that were to take that clause
and use it to destroy the semantics of a program, I would expect
and actually hope that compiler would disappear and never see the
light of day again. I am reaching the conclusion that too much of
the standard was written by lawyers out of touch with real programming.
I certainly hope GCC does not go down the path of, "The strictest
reading of the standard allows us to do this counter-intuitive thing
and thereby let us optimize into oblivion some more code." GCC
needs to try to be useful instead. Maybe it is too late.
Regards, Bruce