问题
I know the C11 standard is only a month old, but the drafts for _Atomic
are much older. I also know the GCC compiler makes a serious effort implementing such features in advance of the standard becoming officially approved. but even there the support is not yet ready for prime-time.
However, I'd be interested in other compilers as well: Visual Studio, or embedded compilers cq. environments. Is anyone compiler provider gearing up to provide such support? Any links are welcome.
I'm asking, because I'm working in automotive embedded development, and I'm wondering if I should move into that direction myself. Until now, most environments (like AutoSAR or Vector OS support) have been providing home-grown solutions, for which the new standard now provides specific syntax and semantics, and as long as compiler authors do not move in the direction of C11, this will remain the only real solution.
回答1:
I think support for the keyword itself will take some time, I haven't seen something yet. For what concerns the library support (support functions) there is already more. In particular I know of gcc that implements generic functions for atomic operations __sync_...
on integer types for most of the platforms.
I am currently working on a compliance layer for P99 for C11. The thread part (on top of POSIX threads) is already there, atomics (using the gcc primitives) are soon to be completed. This will be a generic implementation supporting atomics for all base types via macros that implement the type generic atomic_...
functions that are foreseen in the standard.
It is almost there, you can view a first version on the P99 site, but I'll still need some days to finish it.
回答2:
FreeBSD HEAD includes a somewhat portable version of : http://svnweb.freebsd.org/base/head/include/stdatomic.h?view=markup
It supports three different types of compilers:
- Clang 3.1's atomic intrinsics (not released yet)
- GCC 4.7's atomic intrinsics (not released yet)
- GCC's __sync interface
回答3:
Pelles C version 7.00 (Release Candidate) supports them.
http://www.smorgasbordet.com/pellesc/
来源:https://stackoverflow.com/questions/8741299/does-an-available-compiler-provide-an-implementation-of-the-c11-atomic-keywor