Top 10 Ways to be Screwed by “C”
#15 on the list is especially troubling to me, since it seems like something that could be trapped, yet gcc compiled without comment, even with the vaunted -Wall switch. I couldn’t figure out a way to get gcc to complain, nor did my extensive 10 minute search find anything that would trap this sort of error. I even tried valgrind with it, and it too didn’t seem to think anything was wrong (but that was only after spending another 10 minutes).
(On an aside, there is a switch in gcc called “-fbounds-check”, but that only works for Fortran and Java. Go figure).
There are 18 entries in this “Top 10″ list. Yet, the blog doesn’t prevent this. In fact, it seems to work, just like C.