首页 > TAG信息列表 > constant-expression

c-glvalue整数常数表达式是常数表达式吗?

N4527 5.20 [expr.const] p3 An integral constant expression is an expression of integral or unscoped enumeration type, implicitly converted to a prvalue, where the converted expression is a core constant expression. 5.20 [expr.const] p5 A constant exp

c – 为什么在未评估的操作数中不允许使用lambda表达式,但是在常量表达式的未评估部分中允许使用lambda表达式?

如果我们看一下draft C++ standard部分5.1.2 Lambda表达式第2段说(强调我的前进): The evaluation of a lambda-expression results in a prvalue temporary (12.2). This temporary is called the closure object. A lambda-expression shall not appear in an unevaluated opera

c – 常量表达式中的条件运算符

我尝试使用MSVC 10的以下代码片段,它可以正常工作. enum { FOO = (sizeof(void*) == 8 ? 10 : 20) }; int main() { return FOO; } 我想知道的是:当所有操作数都是常量表达式时,C标准(最好是C 98)是否允许我在常量表达式中使用条件运算符,或者这是Microsoft的怪癖/扩展?解决方

Java编译器是否会预先计算文字的总和?

int i = 10 + 20; 是否真的编译器将处理此代码,添加10 20,字节代码与此代码行相同? int i = 30; 我在哪里可以阅读它?解决方法:是的,您甚至可以自己验证它.拿一个小的Java文件,例如: public class Main { public Main() { int i = 10 + 20; } } 用javac Main.java编译它