C testing framework. ASCII/Unicode portable version

Andriy Palamarchuk apa3a at yahoo.com
Tue Jan 22 07:52:38 CST 2002


--- Dmitry Timoshkov <dmitry at baikal.ru> wrote:
> "Andriy Palamarchuk" <apa3a at 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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sysparams20010122.tar.gz
Type: application/x-gzip
Size: 10225 bytes
Desc: sysparams20010122.tar.gz
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20020122/67e26fb2/sysparams20010122.tar.bin


More information about the wine-devel mailing list