Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <200101311041.LAA27771@mailhost.ri.silicomp.fr> From: Eric PAIRE To: cygwin AT cygwin DOT com Subject: misdefined macro _T in winnt.h Reply-To: Eric PAIRE X-url: http://www.ri.silicomp.com/~paire Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 31 Jan 2001 11:41:14 +0100 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 #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 DOT paire AT ri DOT silicomp DOT 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