use of memset and optimization
john at iastate.edu
Fri Nov 8 10:57:00 EST 2002
> >>>>> "john" == John Hascall <john at iastate.edu> writes:
> >> Not only does gcc 3.0.3 not optimize out the memset() call, it also
> >> doesn't inline any of the functions.
> john> However, it would be perfectly within its rights to do so,
> john> and perhaps some compiler now or in the future does/will.
> I'm not convinced of that. Consider that an expression statement is a
> sequence point. There is therefore a sequence point between the call
> to memset() and the call to free(). If it is possible that a signal
> handler might access the value of the object between those two calls,
> the standard arguably requires that it be able to see the effects of
> the memset().
1) volatile requirement (as you mention)
2) the signal handler has no way to access that object anyway
(it's only pointed to by "key" which is local to the function)
More information about the krbdev