๐คtptacek๐4y๐ผ31๐จ๏ธ14
(Replying to PARENT post)
You need to be routinely running valgrind on every bit of C code you write, and that will catch uninitialized reads along with many other classes of bugs.
๐คrwmj๐4y๐ผ0๐จ๏ธ0
(Replying to PARENT post)
Grey text on white background. Ouch, my eyes.
๐คknorker๐4y๐ผ0๐จ๏ธ0
(Replying to PARENT post)
For example highly vectorized loops that process a big buffer of data, but might read a bit out of bounds at the start or end of the buffer. The algorithm as a whole is guaranteed not to depend on the outcomes of those out of bounds reads, so as long as they can be guaranteed not to segfault, they should be safe.
Not allowing this usually results in either slower code (can't vectorize as much) or bigger code (need to have a special case codepath for the first/last items to be processed). The bigger code is often slower too due to worse branch prediction, more cache pressure, etc.