#define WIDEN(x) WIDEN2(x)
#define __WFILE__ WIDEN2(__FILE__)
I do not understand why the above code works but the following one does not:
#define WIDEN(x) L ## x
#define __WFILE__ WIDEN(__FILE__)
Thax.
Darrian
#define WIDEN2(x) L##x
#define WIDEN(x) WIDEN2(x)
then
WIDEN(__FILE__) first expands the argument __FILE__ and expands it as
WIDEN2("c:\here\there\file.cpp")
and then expands WIDEN2 as
L"c:\here\there\file.cpp")
years ago we referred to this as the "macro FUNARG problem" and we designed languages to
give us control of this explicitly. The C preprocessor was more-or-less thrown together
(and, as macro processors go, is a step backwards from what we knew how to do in 1973), so
kludges like this have to be done (and there are even deeper problems that there are no
kludges to get around)
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm