RE: [GD-Windows] Stopping a thread cleanly
Brought to you by:
vexxed72
From: Jon W. <hp...@mi...> - 2002-02-18 21:48:09
|
> Function calls have nothing do with it. "Assume aliasing across > function calls" is a separate setting. > > This program has an aliasing problem, yet thread 2 has no function calls > in it. See for yourself: The difference in this program would be that I would no think the compiler incorrect to put the values in registers, thus you'd have to use the "volatile" qualifier. However, the compiler cannot correctly make any guesses about whether something on the other end of a pointer changes when you call a function with separate linkage (i e, in a separate translation unit). Basically, my view is that the standard does not require the compiler to be thread, or signal, aware in its code generation, but it DOES require it to be conservative on aliasing. It's already the case that compilers generate thread-unsafe code for some constructs, such as initialization of statics with function scope. Then, what specific compilers do with specific options, is another question (and ultimately, quite relevant :-) Cheers, / h+ |