If I do:
int j = ({int x = 7; x+3;});
In i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) gcc it compiles just fine. The block in question ({int x = 7; x+3;})
returns the value of the last statement as the value of the block. If you remove the parenthesis it doesn't compile. Can I expect this to work in most c compilers?
Additionally, what is the name for this construct? I have had a lot of trouble searching for it because search engines don't index () or {} and c is a terrible search term. I also haven't been able to find anything about it in any of my books, probably because I don't know what to look for.