Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Note that:

  void foo(int p[static 1]);
is effectively a standard way to declare that p must be non-null pointer. I always wondered if any compiler actually makes use of this for optimization purposes.


Wonder no more: at least clang does, since around v3.5. https://godbolt.org/z/jEq5xbMna


If you have a null check on the pointer in the body, GCC will elide it.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: