Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ Confusing Macros

Tags:

c++

I was looking at some windows directx application code and saw that they use the macro _T(x) to set their window name, when looking at the macro definiton I saw this

#define _T(x)       __T(x)

then I followed and looked at __T

#define __T(x)      x

Why does this exist?

like image 590
Noah Avatar asked Jan 26 '23 04:01

Noah


1 Answers

_T(x) is usually a macro for a platform agnostic text character type. In some platforms it may resolve to just x. In others using wide characters it may resolve to L ## x, e.g. _T("abc") may resolve to either "abc", or L"abc".

like image 166
Rotem Avatar answered Jan 30 '23 07:01

Rotem