Re: Someone stomping on our memory

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 11 Nov 2000 01:45:55 +0100

Alex Rousskov wrote:

> Function parameters are equivalent to local variables. All of the
> operators below are "legal" and reliable.
>
> void f(int a1) {
> int a2 = a1;
> int *pa = &a1;
> a2 = *pa;
> *pa = a1;
> }

scope and allocation safe yes. But not entirely safe wrt aliasing... to
much use of the above might confuse compilers when optimization is
turned on. It is not good to mix pointer and direct access to the same
memory area..

/Henrik
Received on Fri Nov 10 2000 - 18:37:09 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:57 MST