Hacker News new | past | comments | ask | show | jobs | submit login

That's what the static keyword means in those array declarators.

    void func(int x[static 10]);
must be called with an argument that is a pointer to the start of a big enough array of int. I can't get recent GCC or Clang to warn on violations of this, though.



There are cases where the compiler can't enforce it:

    void foo(int *p)
    {
      func(p);
    }
How can the compiler know if `p` points to space for 10 integers?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: