- 论坛徽章:
- 0
|
回复 幻の上帝
1. 当真
2. 果然操蛋啊…… 还可以这样……可以, 那呢?
又根据什么来判断下次是 ...
OwnWaterloo 发表于 2011-08-18 00:14 ![]()
1.果然偷懒没翻原文容易阴沟里翻船233。。。想起来是拿GCC验证的时候我一时傻×直接-std=c89忘记-pedantic了。
2.
- for (char*p;int c=0,d=0;)
复制代码 这个是不行……
ISO C++03:
[Note: a for-init-statement ends with a semicolon. ]
6.5.3 The for statement [stmt.for]
1 The for statement
for ( for-init-statement conditionopt ; expressionopt ) statement
is equivalent to
{
for-init-statement
while ( condition ) {
statement
expression ;
}
}
except that names declared in the for-init-statement are in the same declarative-region as those declared in
the condition, and except that a continue in statement (not enclosed in another iteration statement) will
execute expression before re-evaluating condition. [Note: Thus the first statement specifies initialization
for the loop; the condition (6.4) specifies a test, made before each iteration, such that the loop is exited
when the condition becomes false; the expression often specifies incrementing that is done after each
iteration. ]
Iteration statements一节没定义什么是condition。艹蛋的根源:
6.4 Selection statements [stmt.select]
1 Selection statements choose one of several flows of control.
selection-statement:
if ( condition ) statement
if ( condition ) statement else statement
switch ( condition ) statement
condition:
expression
type-specifier-seq declarator = assignment-expression
...
2 The rules for conditions apply both to selection-statements and to the for and while statements (6.5).
The declarator shall not specify a function or an array. The type-specifier-seq shall not contain typedef
and shall not declare a new class or enumeration.
把 = 硬编码到表达式以外的语法实在囧…… |
|