Optimization/clarity coding : what is gcc able to do for me ?

Robert Dewar dewar@adacore.com
Mon Jan 17 19:01:00 GMT 2005


Joe Buck wrote:

> It's up to you as a programmer to implement locking if you want to access
> any variable longer than a "sig_atomic_t" (which is a typedef that defines
> an integral type for which accesses are guaranteed to be atomic on your
> system; it is often "int", but might not be).  Pointer accesses are atomic
> on every machine that I know of, though I am not certain that the language
> standard guarantees this.

It doesn't as far as I know. In Ada there is pragma Atomic to deal
with all such cases (Atomic is rejected if atomic access cannot be
guaranteed). It might be nice to have an analogous attribute in GNU C.



More information about the Gcc mailing list