RE: [Dev-C++] Make switch condition an enum
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-10-20 03:23:37
|
> -----Original Message-----
> From: Per Westermark [mailto:pw...@ia...]
> Sent: Saturday, October 19, 2002 10:03 PM
> To: Ioannis Vranos
> Cc: dev...@li...
> Subject: RE: [Dev-C++] Make switch condition an enum
>
>
> Guess the definition of _T("x")...
>
> #if defined(_UNICODE) || defined(UNICODE)
> #define _T(x) L##x
> #else
> #define _T(x) x
> #endif
>
> This is the OFFICIAL way of writing portable MFC or wxWindows
> programs.
> The L"Hello world" concept requires you to change a huge
> number of strings
> whenever you want to activate/deactivate unicode support.
>
> As you can probably guess, all functions taking a string as a
> parameter
> must also be specially handled.
>
> // Microsoft
> #if defined(_UNICODE) || defined(UNICODE)
> #define _tcslen wcslen
> #else
> #define _tcslen strlen
> #endif
>
> // wxWindows
> size_t wxStrlen(const wxChar *s);
>
> /Per W
Well let UNICODE aside. wchar_t is a wide character type existing in
*all* machines. It belongs to the C/C++ standards. In C90 wchar_t is a
typedef defined in stddef.h. In C++98 it is a *built in* type (and in
all machines using UNICODE, wchar_t is usually UNICODE).
I see no reason why "activate" or "deactivate" wide character support
using "compilation under condition". If your code needs wide character
support so as to work in some platforms, use wchar_t in the first place
(something bad, from all the compilers i have seen, wcout doesn't exist
in MINGW's <iostream> and probably in GCC itself).
Forget all the Win32 bad programming styles. :)
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL: http://run.to/noicys
|