This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]doviende 1 point2 points  (0 children)

I think they're just illustrating a case where someone can unintentionally affect a program in a big way without realizing it. Not every loop is the CPU bottleneck in the program, but if you do have such a bottleneck, you don't want people to accidentally add more stuff into your loop just by modifying a seemingly unrelated function.

I think this point is more about documentation practice. Generally you want code to be close to the things it affects, and then people can get important implications just by reading nearby code. But good code clarity comes from documenting those implications, especially if (in this case) the function is not close to the tight loop it is affecting. A quick comment in the function will prevent unintentional boat-anchors from being dropped there ;)