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: [PATCH] C undefined behavior fix


On Sat, Jan 05, 2002 at 09:55:50AM -0800, Dennis Ferguson wrote:
> Sometimes I know what "foo" + 5 points to.  If we're talking about
> the more general case of converting pointers to an integer representation
> of their bits, doing math on that, and converting the result back
> to a pointer ...

We're not talking about the general case.  An object that the compiler
knows about (either global, file scope static, or on the stack) must be 
involved.

> ... then both device drivers and memory allocators often
> depend on being able to do that fairly freely.

The heap is a different animal, since there we don't know what the
outer-most object really is, so we can't make the same inferences
that we can with compiler controlled objects.

In general, device drivers and memory managers should be safe.



r~


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