4 ms·
Yes, indeed that was a big part of my point! But also, even if I didn't have a choice and had to write the code in C++, I would do it in the style on the slide
by jblow 11y ago
Yes, indeed that was a big part of my point!
But also, even if I didn't have a choice and had to write the code in C++, I would do it in the style on the slide, not the style endorsed by the link on this HN thread.
I do agree that copying a line and changing spots is a common mistake pattern. However, I also still think that in many cases that is the best thing to do because it results in the simplest code. So rather than go through contortions in the actual code to try and prevent this, I am wondering if some kind of IDE pattern matching is a better way to catch this class of errors.