what is this kind of usage, ``braces inside parentheses'', called in C?

Viewed 93
while (({bool a; a =a&&false; a;})) {
    ;
}

will work well.

but

while ({bool a; a =a&&false; a;}) {
    ;
}

end up with

filename.cc: In function ‘int main()’:
filename.cc:103:10: error: expected primary-expression before ‘{’ token
   while ({bool a; a =a&&false; a;}) {
          ^
filename.cc:103:10: error: expected ‘)’ before 
‘{’ token
   while ({bool a; a =a&&false; a;}) {
         ~^
          )
filename.cc:103:35: error: expected primary-expression before ‘)’ token
   while ({bool a; a =a&&false; a;}) {

what keyword should i refer to if i want to learn more about it?

i have seached keywords such as ``braces inside parentheses in C'' but in vain

other attempts:

while (({ ; })) {
    ;
}
filename.cc:105:16: error: could not convert ‘({...})’ from ‘void’ to ‘bool’
   while (({ ; })) {

it seems that ‘({...})’ is a type, something like int, float. am i right? or it is something like lambda function in c++?


thanks to @user2864740, @o11c, @paddy, my problem is solved. it is some kind of ``statement expression'' only available in gcc.

0 Answers
Related