Take the following example:
char* fileName = "C:\\windows\\system32\\kernel32.dll";
uint32_t fileSize = 1163264;
printf("The size of %s is %"PRIu32"\n", fileName, fileSize);
Everything is all right, now if we want transparent unicode support through tchar.h, the code would look like this:
TCHAR* fileName = _T("C:\\windows\\system32\\kernel32.dll");
uint32_t fileSize = 1163264;
_tprintf(_T("The size of %s is %")_T(PRIu32)_T("\n"), fileName, fileSize);
This works if unicode has no . However, if unicode is defined, the compiler breaks with the following error:
error C2308: concatenating mismatched strings
Concatenating wide "The size of %s is %l" with narrow "u"
Now let's look at Microsoft inttypes.h I see:
...
#define _PFX_32 "l"
...
#define PRIu32 _PFX_32 "u"
This means that _T(PRIu32)in the example above it resolves:
_T("l" "u")
... which cannot work, of course, and explains the correct compiler error.
So my question is, how did Microsoft suggest that we use their inttypes.h with _tprintf?