Token pasting

suggest change

Token pasting allows one to glue together two macro arguments. For example, front##back yields frontback. A famous example is Win32’s <TCHAR.H> header. In standard C, one can write L"string" to declare a wide character string. However, Windows API allows one to convert between wide character strings and narrow character strings simply by #defineing UNICODE. In order to implement the string literals, TCHAR.H uses this

#ifdef UNICODE
#define TEXT(x) L##x

Whenever a user writes TEXT("hello, world"), and UNICODE is defined, the C preprocessor concatenates L and the macro argument. L concatenated with "hello, world" gives L"hello, world".

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents