c++winapitchar

Should I use TCHAR today


I am starting to work on a completely new project for Windows Desktops written in C++. When I learned Windows programming, I read that using TCHAR is a great improvement because I can build an ANSI or a Unicode version of my program without changing the code. However, I never really used the option to build the ANSI version. Moreover, in the standard library of C++, there is no TCHAR, I have to create typedefs for std::string, std::stringstream, etc. and their wide string counterparts. So currently I am thinking of abandoning TCHAR in favor of wchar_t, and I collected the following advantages and disadvantages.

Advantages:

Disadvantages:

And my questions:


Solution

  • In modern windows all ANSI functions are internally converting char* to wchar_t* and calling unicode versions of same function. Basically, by adopting TCHAR instead of wchar_t you gain nothing, but have to deal with quirky syntax.