RE: [Dev-C++] Make switch condition an enum
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2002-10-20 16:43:04
|
Bad programming styles aside.
While WinNT/Win2k/WinXP uses Unicode-only in the kernel, older Win95,
Win98 don't have unicode, and have to try and convert any unicode calls
back to 8-bit characters. Guess what. That takes time. What use do I have
of a wchar_t type, when it doesn't exist on the OS?
By #undef _UNICODE, a _T("x") program would then compile to a multi-byte
character set program, i.e. a lot of strange characters without a 16-bit
character type.
Life isn't only about C90, C98, C++98 etc. To write programs the customer
is happy with, you have to make due with the limitations of the OS,
available compilers, ...
/Per W
On Sun, 20 Oct 2002, Ioannis Vranos wrote:
> > -----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
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:
> Access Your PC Securely with GoToMyPC. Try Free Now
> https://www.gotomypc.com/s/OSND/DD
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|