Re:A fun optimization trick from rsync
by stouset on Monday October 29, 2018 @02:45AM
(#18325486)
If all of the methodFuncs fail, this will attempt to jump to whatever address happens to be in memory after the last element of methodFuncs. You've forgotten to stop iterating.
[ Parent
| on HN ]
There is a terminating NULL at the end of the array to stop the iteration.
Re:A fun optimization trick from rsync
by jbverschoor on Monday October 29, 2018 @06:01AM
(#18326198)
oh my... that never went wrong
A terminating null element or logical equivalent in an array is helpful in lots of situations. As one example it simplifies the logic of looking for an element in an array and performing some special operation if it was not found. No bool found variable necessary.
Re:A fun optimization trick from rsync
by jbverschoor on Monday October 29, 2018 @10:56AM
(#18327986)
Well yes, but it can easily be removed by accident, and is easy to oversee. See the parent comment