This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

misdefined macro _T in winnt.h


Hi cygwin people,

I have found a problem with the _T macro definition as it is defined in
w32api/include/winnt.h: "#define _T TEXT" does not compile correctly the
following small program:

------  Cut Here  ------  Cut Here  ------  Cut Here  ------  Cut Here  ------
 #include <windows.h>
 #define __DIR "dir"

 main() {
        size_t len = wcslen(_T(__DIR)) + wcslen(_T("dir"));
        exit(len);
 }
------  Cut Here  ------  Cut Here  ------  Cut Here  ------  Cut Here  ------

In addition, the Microsoft VisualC programming manual also says that _T macro
is identical to _TEXT macro, which is not defined in winnt.h (but TEXT is
defined).

You will find an obvious patch for these 2 problems appended to this mail:
1) _T object-like macro is replaced by _T(q) function-like macro
2) TEXT macro definition is replaced by _TEXT
3) If TEXT macro is not defined, then define TEXT function-like macro as
	being identical to _TEXT one

Best regards,
-Eric
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ Eric PAIRE
Web  : http://www.ri.silicomp.com/~paire  | Groupe SILICOMP - Research Institute
Email: eric.paire@ri.silicomp.com         | 2, avenue de Vignate
Phone: +33 (0) 476 63 48 71               | F-38610 Gieres
Fax  : +33 (0) 476 51 05 32               | FRANCE
------  Cut Here  ------  Cut Here  ------  Cut Here  ------  Cut Here  ------
--- winsup/w32api/include/winnt.h       Wed Jan 31 10:02:09 2001
+++ winsup/w32api/include/winnt.h~      Mon Dec 25 17:43:22 2000
@@ -79,15 +79,12 @@
 typedef TCHAR *LPTCH,*PTSTR,*LPTSTR,*LP,*PTCHAR;
 typedef const TCHAR *LPCTSTR;
 #ifdef UNICODE
-#define _TEXT(q) L##q
+#define TEXT(q) L##q
 #else
-#define _TEXT(q) q
-#endif
-#ifndef TEXT
-#define TEXT(q) _TEXT(q)
+#define TEXT(q) q
 #endif
 #ifndef _T
-#define _T(q) _TEXT(q)
+#define _T TEXT
 #endif
 typedef SHORT *PSHORT;
 typedef LONG *PLONG;


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]