本文介绍了所有C ++编译器都支持async/await关键字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在C ++(UE4框架)中使用async/await语法,但是由于跨平台代码,我不确定这是可能的还是可行的?如果可以,该如何使用?

I want to use async/await syntax in C++ (UE4 framework), but due to cross-platform code I not sure that is possible... Or possible? If yes, how can I use it?

还有在Visual Studio中突出显示的await__await(也包括resumableyield__yield_value)关键字.有什么区别?也许不是所有的编译器都支持此关键字还是单独支持?

And also there are await and __await (resumable, yield and __yield_value also) keywords that highlighted in Visual Studio. What's difference? Maybe not all compilers supports this keywords or supports separately?

gccclang被接受吗?还是不接受,我可以为每个平台单独使用宏.

gcc, clang are accepts it? Or not accepts and I can just use macros for each platform individually.

推荐答案

asyncawait是Microsoft提出的语言扩展,具有多个修订版本,但当前的扩展名为 N4134 .这尚未被纳入标准.

async and await are language extensions proposed by Microsoft with several revisions, but current is N4134. This has not yet accepted into the standard.

许多人反对该建议,例如 http ://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0158r0.html 由于未完全烘焙且尚未在TS中进行全面探索,因此存在一些竞争性提案,例如 N3985 提出了可以在现有语言标准中实现的协程.

The proposal is opposed by many like http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0158r0.html due to not being completely baked and having not been explored fully in a TS and there's competing proposals like N3985 which proposes coroutines that can be implemented within the existing language standard.

据我所知,唯一真正支持异步/等待的编译器是MS Visual Studio.

To my knowledge, the only compiler that actually supports async/await is MS Visual Studio.

作为更新,clang 5.0支持当前的共同例程草案 https://isocpp.org/files/papers/N4663.pdf 现已被接受为TS,并且正朝着C ++ 20标准发展.

As an update, clang 5.0 has support for the current draft co-routines proposal https://isocpp.org/files/papers/N4663.pdf which has now been accepted as a TS and is progressing with an eye toward the C++20 standard.

这篇关于所有C ++编译器都支持async/await关键字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 10:10