Re:Linus on compiler warnings and code reviews
by merlincorey on Wednesday September 23, 2015 @04:43PM
(#10268038)
The warning is true - it is "at least" 10:
Modified also so it would build cleanly with -Weverything -Werror
[ Parent
| on HN ]
Re:Linus on compiler warnings and code reviews
by uxcn on Wednesday September 23, 2015 @05:15PM
(#10268287)
It avoids stepping on memory elsewhere in the program though. My personal preference for C99 and above is to pass the length as a parameter.
int do_stuff(size_t len, int64_t arr[len]);
It still suffers from the pointer decay problem, but it at least forces whoever is reading/writing the code to acknowledge the length.