3 ms·
Sigh. If I had a dollar for every "your compiler should optimize away X", I'd be retired. Should doesn't mean does. Plus, no, often I can't afford a function i
by groby_b 15y ago
Sigh. If I had a dollar for every "your compiler should optimize away X", I'd be retired. Should doesn't mean does.
Plus, no, often I can't afford a function invokation. Because it's yet another cache miss.
If all of those things don't matter (or you work on a large enough team that the benefits of abstraction are worth it), yes, add getters/setters everywhere. For the rest of us, we might have actual _reasons_ why we don't cargo-cult our code.
- cunac 15y agoone good reason would be because setters and getters are way easier to mock out than direct access to member variable And we all want to have code tested , don't we ? :-)
- dextorious 15y agoNo, I most certainly don't.