On Thu, 17 Jan 2002, Andriy Palamarchuk wrote:
--- "Dimitrie O. Paun" dimi@cs.toronto.edu wrote:
On Thu, 17 Jan 2002, Dmitry Timoshkov wrote:
For tests, I think we should in fact use SystemParametersInfo, and then compile the test twice -- for A and for W. Both versions should behave the same, right?
IMHO (after consulting with MSDN) you can write A<->W portable code only with MFC. Let me know if I'm wrong.
You are wrong (or the MSDN is trying to lure you into using the MFC by making false claims).
Your code should never use char or WCHAR, strcpy, and things like that. Instead it should use the things defined in 'tchar.h':
* TCHAR maps to char or WCHAR * _tcscpy maps to strcpy or wcscpy * _tcslen maps to strlen or wcslen * _TEOF maps to EOF or WEOF * _tWinMain maps to WinMain or wWinMain ...
and then the regular structures and APIs:
* xxx maps to xxxA or xxxW
etc, etc.
The problem will be with Winelib's Unicode support though. It has made progress but there may still be some problems and it depends on compiler support. But at least, this will allow us to test it which is a good thing.
I believe that C tests should be ANSI/UNICODE independent as much as possible, and then, at compile time, one can choose to compile either for ANSI (default) or for UNICODE. If we can have a test framework that can compile and run a single test twice, once for ANSI and once for UNICODE, then it's perfect. But otherwise the above solution is good enough. Most people will compile and run the test in ANSI mode and some people will compile and run them in Unicode mode, and that's probably good enough.
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ 1 + e ^ ( i * pi ) = 0