--- Dmitry Timoshkov dmitry@baikal.ru wrote:
"Andriy Palamarchuk" apa3a@yahoo.com wrote:
Attached version of the C testing framework, which
is
implemented with using TCHAR.H macros, so it is portable between ASCII and Unicode platforms. Also implemented test which can be used to test ASCII
and
Unicode API.
You probably want to know that in order to use TCHAR.H you need either gcc >= 2.96,
I know this :-( I strongly prefer to use straigt TCHAR programming, without any conversions. This is why I started to work with it in the first place.
There is no such issue for Windows compilers. Can we have requirement of 2-byte Unicode characters compiler for the tests? In the worst case people, who do not have such compiler will be able to run tests in ANSII mode only.
or mess with converting 4-byte unicode strings to 2-byte and vice versa.
Do you mean using -fwritable-strings parameter or performing explicit conversion? Can we hide explicit conversion in the _T/_TEXT macros?
I would prefer to avoid the whole bunch of confusion with all that mess and use straight CHAR and WCHAR types. Yes, it will mean to have separate tests for ANSI and Unicode and will require slightly more work to type WCHAR str[] = {'u','n','i','c','o','d','e',0}; instead of a simple WCHAR str[] = L"unicode";
IMHO this is much bigger mess than with compilers.
Please take into account the fact that everyone, who uses TCHAR, actually needs to think twice in any case. TCHAR makes it only harder to understand, what really happens.
Here I don't agree with you. Programming with TCHAR is *exactly* the same as programming with WCHAR, but with different names. You think once - in WCHAR terms and get as a bonus ANSII version!
In fact, code became clearner after I removed "if (has_unicode()) " blocks, A<->W conversions, letters "A", "W" from API names. I feel that in this case I don't need to "think twice" - once in terms of ANSII, the second time - in terms of Unicode. I moved test completely to using TCHAR (attached). Compare it with the version which uses explicit "W"/"A" calls.
Andriy Palamarchuk
__________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/