4 ms·
You can do f(int n, int (*a)[n]) and it does what it looks like, since C99. https://godbolt.org/z/8dfKMrGqv https://godbolt.org/z/8dfKMrGqv
by veltas 1y ago
You can do f(int n, int (*a)[n]) and it does what it looks like, since C99.
https://godbolt.org/z/8dfKMrGqv https://godbolt.org/z/8dfKMrGqv
- sirwhinesalot 1y agoThat's an entirely different thing (VLAs)
- veltas 1y agoThere's no VLA in my example.
- sirwhinesalot 1y agoYour example doesn't do any bounds checks, it just lets you get the sizeof. And the reason the sizeof works is the VLA infrastructure (which is not supported by MSVC so it won't compile the code). What I want is -fbounds-safety from clang.
- navi-desu 1y agoit does do bounds checks if you -fsanitize=bounds, in gcc at least (and msvc is stuck on partial c11 support to this day, so imo, i don't quite think it's a fair target when comparing things to new features anyway)