vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

c_initializer.c (637B)


      1 // Compound literals and initializers inside expressions
      2 void test(void)
      3 {
      4     int a[(struct foo){ 42 }.bar];
      5     struct foo b = ((struct foo){ });
      6     _Static_assert(sizeof (int []){ 1, 2, 3 } == 3 * sizeof (int), "");
      7     for (struct foo i = { };;) break;
      8     int c[(struct foo) <% 42 %>.bar];
      9     struct foo d = ((struct foo) <% %>);
     10     f((int [2][2]){{ 1, 2 }, { 3, 4 }});
     11     syscall(SYS_clock_settime, CLOCK_REALTIME,
     12         tv ? &((struct timespec){ .tv_sec = tv->tv_sec,
     13             .tv_nsec = tv->tv_usec * 1000 }) : 0);
     14     f((struct timespec)
     15       <% .tv_sec = 0 %>);
     16     int e[){ 42 }.bar];
     17     f(a { 1 }); f(a, { 1 });
     18 }