今天无意中被彻底打击到了.
#include <stdio.h>
int getN() {
return 100;
}
int main(int argc, char* argv[]) {
int b[getN()];
printf("%d:%d\n", sizeof(b), sizeof(int));
return 0;
}
gcc version 4.0.1 (Apple Inc. build 5493)
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
均编译ok
混乱了一阵后, 发现是C99增加的
C99 introduced several new features, including inline functions, several new data types (including long long int and a complex type to represent complex numbers), variable-length arrays, support for variadic macros (macros of variable arity) and support for one-line comments beginning with //, as in BCPL or C++. Many of these had already been implemented as extensions in several C compilers.
看来要好好看看C99了
在DEVC 试了下,的确行的,可是那段英文还是没看懂………………..
ps.第一次来面具的博客,嘿嘿,以前没发现
[回复]
呵呵blog设置了垃圾评论过滤, 你的竟然被自动列入待审核, 哈哈
[回复]
再来透明的面具这看看~~
[回复]