编译时间运算符 [英] Compile time operators

查看:81
本文介绍了编译时间运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以列出C ++中所有可用的编译时运算符吗?

Could someone please list a all compile time operators in available in C++?

推荐答案

C ++中有两个运算符,它们的结果始终可以在编译时确定,而与操作数无关,它们是sizeof [1 ]和:: [2].

There are two operators in C++ whose result can always be determined at compile-time, regardless of the operand(s), and those are sizeof[1] and ::[2].

当然,在编译时可以解析其他运算符的许多特殊用途,例如,整数常量表达式的标准中列出的那些运算符.

Of course there are plenty of particular uses of other operators that can be resolved at compile-time, for example those listed in the standard for integer constant expressions.

[1]与C ++不同,C99具有可变长度的数组类型.在编译时无法确定应用于VLA的sizeof.一些C ++编译器提供VLA作为扩展.

[1] C99, unlike C++, has variable length array types. sizeof applied to a VLA can't be determined at compile-time. Some C++ compilers provide VLAs as an extension.

[2],即可以在编译时确定表达式的结果是什么实体.如果实体是对象,则对象的值是另一回事.

[2] that is, it can be determined at compile time what entity is the result of the expression. If the entity is an object, then the object's value is another matter.

这篇关于编译时间运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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