3 ms·
I use QtCreator and it would be able to do this. If I had #define SEVENTEEN 17 and another macro #define OTHER_THING 17 I could simply refactor SEVENTEEN t
by stagger87 6y ago
I use QtCreator and it would be able to do this.
If I had
#define SEVENTEEN 17
and another macro
#define OTHER_THING 17
I could simply refactor SEVENTEEN to
#define MY_NEW_NAME 17
which would change all occurrences of SEVENTEEN to MY_NEW_NAME, and then I would just change the value of that macro.
#define MY_NEW_NAME 23
- sokoloff 6y agoBut the devs who would define SEVENTEEN to be 17 are unlikely to define OTHER_THING at all, since there’s a “perfectly good” macro that evaluates to 17 and avoids hard-coded numbers already. (They might even cite DRY: Don't Repeat Yourself as a misapplied best-practices shibboleth.) See the (contrived) Declaration of Independence line above. Your editor would dutifully change the date to be off by six hundred years.
- stagger87 6y agoSure, I understand what you mean. To be honest, that sounds like a different issue, one that would arise after additional circumstances took place. I still stand by my initial comment, that if you had the quick ability to refactor SEVENTEEN at the time this developer committed this, it wouldn't be a very big deal, and this developer could be told that good variable names are important and he wouldn't be stuck as a junior developer forever, lol.