News for hackers. Stuff that matters.
Re:Building the Linux kernel with clang by scatters on Thursday September 21, 2017 @09:35AM (#15303167)
You're thinking of flexible or zero-length array members (`int[]` as the terminal field, or mostly equivalently, where supported, `int[0]`). VLAs in a struct only really make sense for a local type i.e. a struct defined and used within a function:

    void foo (int n) {
        struct S { int x[n]; };
    }
https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Re:Building the Linux kernel with clang by benmmurphy on Thursday September 21, 2017 @09:44AM (#15303278)
thanks. that makes sense.

    #include <stdio.h>
    void foo (int n) {
      struct S { int x[n]; int y; };

      printf("offset: %ld\n", __builtin_offsetof(struct S, y));
    }

    int main() {
      foo(2);
      foo(16);
    }

    offset: 8
    offset: 64