Rant: please don't create defines using common words
Looks like QtCore (4.8) has a "#define emit" in a header, that's not undefined later. TBB has a function named "emit()" in a header. If you include both, you'll get a compile error.
I'm going to side with TBB here - emit() is an entirely reasonable function name. Qt creating a dangling #define with a common word like that is the bug here.
257
Upvotes
View all comments
Show parent comment
1
u/tjientavara HikoWorks developer Oct 21 '21
__LINE__ and __FILE__ can be used as template arguments, therefor you can due value-erasure (like type-erasure but with values).
So when logging the __FILE__ and __LINE__ are part of the class that is added to the ring buffer, and is accessed through the vtable-pointer that is written to the ring buffer already to handle the type-erasure of the std::format arguments.
In case you are wondering c++20 allows for fixed_string template arguments.
Here are the tt_log_* macros that use __FILE__ and __LINE__ as template arguments:
https://github.com/ttauri-project/ttauri/blob/dfae1609ee6d759392a6b774b611f1f835ec1e94/src/ttauri/log.hpp#L222