GCC有一个内置的编译时断言吗? [英] Does GCC have a built-in compile time assert?

查看:369
本文介绍了GCC有一个内置的编译时断言吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们现有的编译时断言实现是基于负数组索引,并且它在GCC上提供差的诊断输出。 C ++ 0x的 static_assert 是一个非常好的功能,它提供的诊断输出更好。我知道GCC已经实现了一些C ++ 0x功能。有没有人知道 static_assert 是否在其中,如果是那么自从什么GCC版本?

Our existing compile-time assert implementation is based on negative array index, and it provides poor diagnostic output on GCC. C++0x's static_assert is a very nice feature, and the diagnostic output it provides is much better. I know GCC has already implemented some C++0x features. Does anyone know if static_assert is among them and if it is then since what GCC version?

推荐答案

根据此网页,gcc已拥有 static_assert 自4.3。

According to this page, gcc has had static_assert since 4.3.

这篇关于GCC有一个内置的编译时断言吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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