I have some legacy C++ code that I am trying to understand a bit better. One issue I am getting confused with is this with a line like this:
#define LOG_TRACE_ERROR(s) LOG_traceError( _T(__FILE__), __LINE__, s )
which is in a header file. I can see the LOG_TRACE_ERROR is what the code is calling and it passes it a string, and I can see that LOG_traceError is a function that actually does the work, so I assume this line is mapping the two different names for the function together? What is confusing me is why is the parameter list different (just a string for LOG_TRACE_ERROR and (_T(FILE), LINE, s ) for LOG_traceError). Also I cant find _FILE_ or _LINE_ or s defined anywhere so how does the program know what they are?
_FILE_expands to the file name._LINE_expands to the line number.sis the parameter you pass to the macro.When you write:
the preprocessor will transform it to:
_T()is a macro related to UNICODE. If in a unicode environment, it will transform your string to awchar_t*.