Re:Is the preprocessor still needed in C++? (2017)
by PaulDavisThe1st on Sunday December 06, 2020 @12:22PM
(#25324929)
Since #define will still exist, I'd suggest
#define __WHERE__ std::source_location::current()
:)
- it has file name, line number, and char number! That already makes the number of characters more similar if that’s your metric
- it can be forwarded/passed around. It’s much harder to pass macros around
- it can easily capture the caller’s location rather than the location of the macro