Sunday 21 January 2018

c - Does an available compiler provide an implementation of the C11 '_Atomic' keyword and its related header 'stdatomic.h'?

itemprop="text">

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 href="http://gcc.gnu.org/wiki/Atomic" rel="nofollow">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.



class="post-text" itemprop="text">
class="normal">Answer



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 rel="nofollow">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 href="http://gustedt.wordpress.com/2012/01/02/emulating-c11-compiler-features-with-gcc-_generic/"
rel="nofollow">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.


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...