简体   繁体   English

可用的编译器是否提供C11'_Atomic'关键字及其相关标题'stdatomic.h'的实现?

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

I know the C11 standard is only a month old, but the drafts for _Atomic are much older. 我知道C11标准只有一个月的历史,但_Atomic的草稿要早得多。 I also know the GCC compiler makes a serious effort implementing such features in advance of the standard becoming officially approved. 我也知道GCC编译器在标准获得正式批准之前会认真努力实现这些功能。 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. 但是,我也对其他编译器感兴趣:Visual Studio或嵌入式编译器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. 到目前为止,大多数环境(如AutoSAR或Vector OS支持)一直在提供自行开发的解决方案,新标准现在提供特定的语法和语义,只要编译器作者不向C11方向移动,这将是仍然是唯一真正的解决方案

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. 特别是我知道gcc在大多数平台的整数类型上实现原子操作__sync_...泛型函数。

I am currently working on a compliance layer for P99 for C11. 我目前正致力于C11的P99合规层。 The thread part (on top of POSIX threads) is already there, atomics (using the gcc primitives) are soon to be completed. 线程部分(在POSIX线程之上)已经存在,原子(使用gcc原语)很快就会完成。 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. 这将是一个通用实现,通过宏实现所有基类型的atomic_... ,实现标准中预见的类型泛型 atomic_...函数。

It is almost there, you can view a first version on the P99 site, but I'll still need some days to finish it. 它几乎就在那里,您可以在P99网站上查看第一个版本,但我仍需要几天才能完成它。

FreeBSD HEAD includes a somewhat portable version of : http://svnweb.freebsd.org/base/head/include/stdatomic.h?view=markup FreeBSD HEAD包含一个可移植的版本: 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) Clang 3.1的原子内在函数(尚未发布)
  • GCC 4.7's atomic intrinsics (not released yet) GCC 4.7的原子内在函数(尚未发布)
  • GCC's __sync interface GCC的__sync接口

Pelles C version 7.00 (Release Candidate) supports them. Pelles C版本7.00(候选版本)支持它们。

http://www.smorgasbordet.com/pellesc/ http://www.smorgasbordet.com/pellesc/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM