Hi,
On 17/08/17 13:35, Volodymyr Babchuk wrote:
I wrote this small test program:
#include <stdio.h>
struct test
{
int a[2];
};
int main (int argc, char* argv[])
{
printf("%d\n", ((struct test){{1,2}}).a[0]);
return 0;
}
It is compiles with gcc --std=c89 without warnings.
This is because GCC supports compounds literals in C89 as an extension
(see [1]).
+ ((d0) << 24 | (d1) << 16 | (d2) << 8 | (d3) << 0), \
+ ((d4) << 24 | (d5) << 16 | (d6) << 8 | (d7) << 0)}})
+
[1] http://port70.net/~nsz/c/c89/c89-draft.html#3.5.7
... this also doesn't have anything like that.
I'm sorry, I don't get what do you mean under "this".
The web page does not mention (<type>){<initializers>}. Which is normal
because this also appears in c99 (see [2]).
Jan
Cheers,
[1] https://gcc.gnu.org/onlinedocs/gcc-4.3.1/gcc/Compound-Literals.html
[2] http://en.cppreference.com/w/c/language/compound_literal
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel