Hacker News new | ask | show | jobs
by sesuximo 2027 days ago
Source location is so much more than that macro!!

- 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

1 comments

Since #define will still exist, I'd suggest

   #define __WHERE__ std::source_location::current()
:)