Let's read the code. (I have no idea what it does, but I can read code)
First, why are there two defines as you point out? One of them is used when COMPILE_WSCANF
is defined, the other is used otherwise. What is COMPILE_WSCANF
? If we look further down the file, we can see that different functions are defined. When COMPILE_WSCANF
is defined, the function we end up with (through various macros) is vfwscanf
otherwise we get vfscanf
. This is a pretty good indication that this file might be used to compile two different functions one for normal characters, one for wide characters. Most likely, the build system compiles the file twice with different defines. This is done so that we don't have to write the same file twice since both the normal and wide character functions will be pretty similar.
I'm pretty sure that means that this macro has something to do with wide characters. If we look at how it's used, it is used to wrap character constants in comparisons and such. When 'x'
is a normal character constant, L'x'
is a wide character constant (wchar_t
type) representing the same character.
So the macro is used to wrap character constants inside the code so that we don't have to have #ifdef COMPILE_WSCANF
.