by knorker · 5y ago · 0 comments
The second paragraph talks about setting a #define before including a header, as if this is still the 90's.
I'm not shitting on the library in general, I'm saying the second paragraph disproves the title.
It can be a trade-off, but becoming less and less so. I'll admit to not looking at the implementation, but when you sell it as "modern" then it's not OK to do it for performance, for example.
And almost every single use I've seen "for performance" actually has zero or negligible performance impact.
Moreover, because of `#define`s, the effect of including a file can be entirely different, so a compiler can never say "Oh, I know what's in this include file already, I don't need to include it again in other translation units".
Of course #define's have many uses, and at present cannot be avoided entirely, but C++ has been making an effort to have other mechanisms put in place so as to obviate the use of #define's
In particular, look for CppCon talks about Modules.
#define definitely is not "modern". If nothing else it'll set you up for having problems modularizing it in the future.
I'm not talking about "The simplest option that comes to mind", but "modern C++".