Mail Archives: cygwin/2001/02/05/13:49:18
"J. J. Farrell" wrote:
>
> > From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
> >
> > Eric Paire wrote:
> > >
> > > Sorry folks, I have forgotten to tell you to compile it with the _UNICODE
> > > and UNICODE defined. Here is a corrected version that has some problems
> > > when compiled:
> > >
> > > ------ Cut Here ------ Cut Here ------ Cut Here ------ Cut Here ------
> > > #define __DIR "dir"
> > > #define _UNICODE
> > >
> > > #include <stddef.h>
> > > #include <tchar.h>
> > > main() {
> > > size_t len = wcslen(_T(__DIR)) + wcslen(_T("dir"));
> > > size_t len2 = wcslen(_TEXT(__DIR)) + wcslen(_TEXT("dir"));
> > > exit(len);
> > > }
> > > ------ Cut Here ------ Cut Here ------ Cut Here ------ Cut Here ------
> > >
> > > You will see that the problem is around the evaluation of the __DIR macro
> > > (there is no problem with "dir"), both for _TEXT and _T. In addition, this
> > > should be fixed also for the _T and _TEXT definitions in <winnt.h>, which
> > > should be coherent with those in <tchar.h> (They are not for now, as _T is
> > > defined either as an object-like macro (in <winnt.h>) or as a function-like
> > > macro (in <tchar.h>)).
> > >
> > > If you want me to provide you with a patch (and a ChangeLog), let me know...
> >
> > No, I don't need a patch. I do need to know if
> > L"dir" == L("dir")
> > ? The problem with this macro is the use of the macro concatenation ##
> > and the order in which the macros are resolved. Currently we have
> > #define _T(x) L ## x
> > and if you pass a macro FOO as an argument to this macro you get LFOO
> > returned and not the value of FOO appended to L. If I change this to
> > #define _T(x) L(x)
> > then I get returned L("bar") where "bar" is the value of FOO. This
> > allows the program to compile but does L"bar" == L("bar")?
>
> No. I'm certain of that, more or less ...
>
1) If that is true then what is the purpose of function L()?
2) Can someone who has MSVC++ tell me what the _T(__dir) expands to
using the above example?
3) Is it legal to pass a MACRO as an argument to the _T() macro?
Earnie.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -