On 02/24/2012 09:24 PM, Girkar, Milind wrote: > > This does make the size/alignment of the atomic type different from the > unqualified type - can somebody highlight the disadvantages due to this > difference? The only thing I can think of is maybe casting. Casting from a smaller object to a larger atomic object could become problematic since the atomic may access more memory than the unqualified type has allocated. Casting from atomic to unqualified should be OK as long as the padding is at the end of the atomic object. Does C11 have any rules about casting to/from an Atomic?
I don't think padding issues apply to arithmetic objects since we only support 1,2,4,8 and 16 byte objects. ie, we dont have to worry about a 3 byte atomic_fetch_add operating on a 4 byte padded value (which is effectively left shifted 8 bits). Will that always be true? It's probably not an issue... > Also, is there any effort going on to implement the C _Atomic in gcc? > I plan to work on C11 Atomic support for the next release, GCC 4.8. I expect to provide a compile time flag to disable the atomic padding/alignment should someone decide they don't want it, but the default option would be whatever we decide on as 'good' padding/alignment. Andrew _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
