3 ms·
> Can anyone validate this usage of the "feature"? It's considered bad practice, yep. I would absolutely reject any code review that abused the preprocessor li
by humanrebar 10y ago
> Can anyone validate this usage of the "feature"?
It's considered bad practice, yep. I would absolutely reject any code review that abused the preprocessor like that.
The only legitimate way to use it I've seen is for "white box" testing... when you have a nontrivial amount of private helper code and you want to be able to test it. Then defining "private" to be "public" for only that test compilation cuts down on the amount of work needed with basically no risk.
That being said, I prefer refactoring out all that private data and code into utilities and such. There are other ways to get good encapsulation in C++, if that's the concern.