Thread: Unicode & Good Program Design :: C++

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348

    Unicode & Good Program Design :: C++

    Hi.

    I read the first three chapters of Programming Applications for Microsoft Windows (Dv-Mps General) by Jeffrey Richter. I believe it is an exception Windows programming book with key concepts no Windows programmer must know.

    Anyways, in chapter 2, he dicusses Unicode. I would like to know the future of non-unicode data type include char. For example, Richter thoroughly explains the using of TChar.h, TCHAR, _UNICODE, UNICODE, _TEXT, TEXT, L, _tcscpy, etc.

    For Windows programming, do you define both _UNICODE and UNICODE even though _UNICODE is for C library meanly it is for non-Windows environment?

    For Windows programming, is it better to use L("string") or TEXT("string")?

    In generally, I would like to know if TChar.h is of any use for Windows programming because I believe _TEXT, TEXT, other macros are from c run-time library.

    Thanks,
    Kuphryn

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>For Windows programming, do you define both _UNICODE and UNICODE even though _UNICODE is for C library meanly it is for non-Windows environment?<<

    Normally I would just define UNICODE and only use _UNICODE if I required a string function that was not available in win32 API. I think the tchar.h string mappings are useful for win programming just now because of win9x but presumably as these os's get retired and become obsolete it may reduce to a 'nice to have' rather than a 'must have'.

    >>For Windows programming, is it better to use L("string") or TEXT("string")?<<

    I use TEXT or _T but I compile for both win9x/2k. I use L("string") for GDI+ because it's UNICODE only so an explicit conversion is better otherwise I get lots of errors when UNICODE is not defined.

    >>In generally, I would like to know if TChar.h is of any use for Windows programming because I believe _TEXT, TEXT, other macros are from c run-time library. <<

    Sometimes I find it is for the reasons mentioned above.

    However, as a simple hobbyist, my use/abuse of these may not be the 'proper' way.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Okay. Thanks.

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  3. Question - GUIs and Actual Program Design
    By Enoctis in forum C++ Programming
    Replies: 10
    Last Post: 10-03-2005, 08:51 PM
  4. program design question
    By Chaplin27 in forum C++ Programming
    Replies: 0
    Last Post: 06-23-2005, 06:58 PM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM