Click here to Skip to main content
15,919,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: please explain how the following C programs work Pin
Christian Graus2-Jul-01 23:09
protectorChristian Graus2-Jul-01 23:09 
GeneralRe: please explain how the following C programs work Pin
markkuk3-Jul-01 0:23
markkuk3-Jul-01 0:23 
GeneralSTL and UNICODE Pin
Nick Blumhardt2-Jul-01 17:19
Nick Blumhardt2-Jul-01 17:19 
GeneralRe: STL and UNICODE Pin
Michael Dunn2-Jul-01 18:52
sitebuilderMichael Dunn2-Jul-01 18:52 
GeneralRe: STL and UNICODE Pin
Nick Blumhardt2-Jul-01 19:11
Nick Blumhardt2-Jul-01 19:11 
GeneralRe: STL and UNICODE Pin
2-Jul-01 21:30
suss2-Jul-01 21:30 
GeneralRe: STL and UNICODE Pin
3-Jul-01 5:02
suss3-Jul-01 5:02 
GeneralRe: STL and UNICODE Pin
3-Jul-01 12:30
suss3-Jul-01 12:30 
You have missed the point - TCHAR addresses the storage issue (8 bit versus 16 bit), but nothing else.

When you say something like : "You might not wan't unicode at the moment, but in the future who knows?", you are implying that the only thing that is different between a UNICODE string and an ASCII string is it's size. This is completely incorrect! A program that is written using TCHAR is NOT a UNICODE program - it is a program that uses 16 bits to store each ASCII character. If "in the future" you really do want a UNICODE program, then you will have to review and probably rewrite any and all code that actually examines the strings in any way (especially I/O code), to reflect to details of the UNICODE specification.

There are two main reasons to use UNICODE in a Windows program.

1. Efficiency. Since NT/2000/XP are all UNICODE systems internally, you avoid the 'thunking' layer of the 'A' versions of the API if you use the native 'W' versions (turned on by "#define _UNICODE"). In this case you get some sort of efficiency gain, but you re NOT writing a true UNICODE program - you are writing a UNICODE program that uses only the ASCII subset. Of course you can do this, but do not fool yourself into believeing you are writing a UNICODE program!

2. True UNICODE. In this case you are writing a program that needs to deal with Asian, Middle Eastern or European languages. UNICODE gives you the ability to store all of these, but you must work carefully to write code that works with strings - TCHAR is of no use at all for this!

I have found that if you are using UNICODE for point(1), then TCHAR has value - it allows you to write one code base, then compile it into different exe's - one ASCII, one UNICODE. The UNICODE version will have a slight performance boost.

However, if you are writing UNICODE for reason (2), then I have found TCHAR to be more trouble than it is worth - it constantly 'hides' the real type, and allows code to be written that will com;ile in different environments, but which does not correctly run in thise environments - in other words, it is very dangerous to write 'library' code using TCHAR, and then assume that it actually is UNICODE compliant.


GeneralRe: STL and UNICODE Pin
[James Pullicino]3-Jul-01 5:18
[James Pullicino]3-Jul-01 5:18 
Generalload image Pin
Kathrin2-Jul-01 16:08
Kathrin2-Jul-01 16:08 
GeneralRe: load image Pin
Christian Graus2-Jul-01 17:38
protectorChristian Graus2-Jul-01 17:38 
GeneralRe: load image Pin
Kathrin3-Jul-01 21:10
Kathrin3-Jul-01 21:10 
GeneralRe: load image Pin
Erik Thompson3-Jul-01 7:28
sitebuilderErik Thompson3-Jul-01 7:28 
GeneralRe: load image Pin
Kathrin3-Jul-01 22:00
Kathrin3-Jul-01 22:00 
GeneralRe: load image Pin
Erik Thompson4-Jul-01 7:24
sitebuilderErik Thompson4-Jul-01 7:24 
GeneralRe: load image Pin
Kathrin4-Jul-01 19:08
Kathrin4-Jul-01 19:08 
GeneralRe: load image Pin
Christian Graus4-Jul-01 19:15
protectorChristian Graus4-Jul-01 19:15 
Generalchange filename Pin
2-Jul-01 14:07
suss2-Jul-01 14:07 
GeneralRe: change filename Pin
Carlos Antollini2-Jul-01 14:56
Carlos Antollini2-Jul-01 14:56 
GeneralRe: change filename Pin
2-Jul-01 15:21
suss2-Jul-01 15:21 
GeneralRe: change filename Pin
3-Jul-01 5:22
suss3-Jul-01 5:22 
GeneralCOM IDL Pin
William Bartholomew2-Jul-01 12:42
William Bartholomew2-Jul-01 12:42 
GeneralRe: COM IDL Pin
Richard Caetano2-Jul-01 13:43
Richard Caetano2-Jul-01 13:43 
GeneralRe: COM IDL Pin
Richard Caetano2-Jul-01 13:47
Richard Caetano2-Jul-01 13:47 
GeneralAudio looping using waveform functions. Pin
2-Jul-01 10:47
suss2-Jul-01 10:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.