我給出了一個例子來說明我在第6行中的意思是什麼樣的作業風格。這樣的分配風格是否有明確的定義?
1 #include<stdio.h>
2
3 int main(int argc,char *argv[])
4 {
5 int a,b,c;
6 c = ({ a=5; b = a+1;});
7 printf("%d\n%d\n%d\n",a,b,c);
8 return 0;
9 }
我不知道什麼{}
is.It不是初始化數組int arr[]={1,2,3}
使用的列表。
更新: 可能使用這種方法,我可以定義功能在GCC的功能或者一個錯誤(版本4.7.2(Ubuntu的/ Linaro的4.7.2-2ubuntu1))
1 #include<stdio.h>
2 #include<math.h>
3 int main(int argc,char *argv[])
4 {
5 int a,b;
6 b = ({int cos(i){return 0;};a = 0;cos(a);});
7 printf("%d\n%d\n",a,b);
8 b = cos(0);
9 printf("%d\n%d\n",a,b);
10 return 0;
11 }
輸出:
0
0
0
1
http://stackoverflow.com/questions/1635549/in-what-versions-of-c-is-a-block-inside-parenthesis-used-to-return-a-value-valid – DCoder
也許gcc - 迂腐 - 牆壁是我的不錯選擇 – yuan