C ++ 2a合约编程和编译器 [英] C++2a contract programming and compilers

查看:157
本文介绍了C ++ 2a合约编程和编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣研究最近接受的针对C ++ 20的合同编程用于学习和调查目的.

I'm interested in studying the recently accepted contract programming for C++20 for learning and investigation purpose.

在寻找编译器支持时,我很失望没有找到任何支持. gccclang都非常清楚,它们在--std=c++2a模式下不支持此功能.

As I'm looking around for compiler support, I'm disappointed to not find any. Both gcc and clang are quite clear they do not support this feature within their --std=c++2a mode.

由于该批准是最近才批准的,所以对于当前的编译器不支持所建议的确切语义,我并不感到惊讶.不过,令我感到惊讶的是,绝对没有任何东西,甚至没有编译器特定的扩展,它甚至可以以有限的方式模仿相同的功能.

Since the approval is pretty recent, I'm not too surprised that current compilers do not support the exact semantic proposed. What is more surprising to me though is that there is absolutely nothing, not even a compiler-specific extension which would mimic, even in a limited way, the same feature.

我希望C ++委员会仅考虑通过编译器或特定于目标的扩展在现场证明自己的功能.批准用于C ++ 20的此功能表明,应该可以在某个位置访问该功能.但是到目前为止,我一直找不到它.

I was expecting the C++ committee to only consider features that have proven themselves on the field, typically through compiler or target specific extensions. Approving this feature for C++20 suggests that the feature should be accessible somewhere. But so far, I've been unable to find it.

目前是否可以尝试C ++合约编程?甚至使用一组特定于编译器的扩展?

Is there a way to experiment with C++ contract programming currently ? even using a set of compiler-specific extensions ?

推荐答案

您可能想尝试使用Clang进行合同的实验性实施.

You might want to try this experimental implementation of contracts in Clang.

这篇关于C ++ 2a合约编程和编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆