Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the point of this kind of macros?

#define NAME(x) TEXT(x)
#define TEXT(quote) __TEXT(quote)   // r_winnt
#define __TEXT(quote) quote         // r_winnt

The above is from winNT.h, isn't NAME("Virtual Cam") the same as "Virtual Cam",what's the point to use this macro?

like image 700
user198729 Avatar asked Aug 18 '10 12:08

user198729


2 Answers

__TEXT macro expansion is selected based on whether UNICODE flag is defined or not. If not it just expands to quote else it will append L to the quote so that it becomes L"Virtual Cam" . This string is interpreted as a wide char string.

like image 121
Naveen Avatar answered Oct 01 '22 02:10

Naveen


Depends on if your system is #defined to use Unicode. Then it will automatically change the literal for you to be a wide literal instead of a char literal.

like image 35
Puppy Avatar answered Oct 01 '22 01:10

Puppy