UNICODE: Why not use TCHAR instead of CHAR?

Started by
4 comments, last by The big Question? 23 years, 12 months ago
Well I´ve been around this board for a while, and nobody seems to be concerned about UNICODE which is character-set for Win2000/NT, where ANSI is the character-set for Win95/98. Everbody, I´ve seen, uses LPSTR/CHAR instead of PTSTR/TCHAR, which forces Win2000 to convert every character from ANIS into UNICODE, which is VERY SLOW. Now the question is: Why don´t you people, program with Win2000 and UNICODE in mind? Don´t you like Win2000 (-: ??? Because it can´t be so hard to replace CHAR with TCHAR and PSTR with PTSTR, and then write: #define UNICODE // in the header-file -Hope somebody will answer, because I don´t get it.
<<>> The Big ? <<>>
Advertisement
I think that may because none of us wants to create a NT/2000 build as well as a Win9x build. And seriously, in game development, how many times do you call Windows API calls on a string? Unless you do it every frame, it doesn''t really matter.
Honestly, getting into the habit of writing Unicode compatible code is a good one to get into. This will really help your code portability in the future.

quote:Original post by SiCrane

And seriously, in game development, how many times do you call Windows API calls on a string? Unless you do it every frame, it doesn''t really matter.


Yeah, you''d think that, but some of my recent experiences have proven otherwise. Recently, I starting working on a port of a game from the PC to the Dreamcast (which can use WinCE). You wouldn''t believe the amount of problems we have ran into. Not only was the amount of code to change quite a bit larger than expected, some extremely nasty errors were coming up from missed changes and memory overwrites (Unicode is 2 bytes per character).

All in all, several weeks were invested in either code changes or bug tracking that could have been avoided by simply using the generic mappings that are availible when the original code was produced.
quote:Original post by SiCrane
I think that may because none of us wants to create a NT/2000 build as well as a Win9x build. And seriously, in game development, how many times do you call Windows API calls on a string? Unless you do it every frame, it doesn''t really matter.


No but still if you later on want to convert some of your code to Win2000 (or Win2002 at that time), it is much easier just to #define UNICODE, than editing though a whole game and replacing CHAR with TCHAR and so on.

And ANSI is dead while UNICODE is the furture of Windows,
so can´t damage to write clever which is aware of the furture (:
<<>> The Big ? <<>>
quote:
No but still if you later on want to convert some of your code to Win2000 (or Win2002 at that time), it is much easier just to #define UNICODE, than editing though a whole game and replacing CHAR with TCHAR and so on.

And ANSI is dead while UNICODE is the furture of Windows,
so can´t damage to write clever which is aware of the furture (:


What do Linux programmers do? Do I have to worry about this??
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away"--Henry David Thoreau
I don´t know what Linux uses, but there must be some Linux fan out there who knows.

Another reason I can think of why people should use unicode is that unicode supports almost all character-formats in the world.
Now you can use the same sourcecode for a game in Japan as you would use for a game in USA.
This could save a lot of time in translation of games/apps from USA-english to One of the far-eastern languages.
<<>> The Big ? <<>>

This topic is closed to new replies.

Advertisement