Thread: How do I peform this to an array?

  1. #31
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    TCHAR is a typedef defined in windows.h, TEXT() is a macro defined in windows.h. That's certainly Windows-specific. You can emulate them on other platforms, of course.

    The _TCHAR typedef and the _T() and _TEXT() macros are defined in tchar.h, which is a Microsoft-specific header, although other Windows vendors probably provide it too, for compatibility.

    The whole point of the duality there is that Win9x and below use narrow characters natively, while WinNT uses UTF-16 natively and narrow characters only in emulation, which imposes a speed penalty. Furthermore, WinCE and derivates do not support the narrow APIs at all. Therefore, in the interest of Win32 code reuse, it's a good idea to use the UNICODE switch to make your code compatible with both modes.

    In non-Win32, portable programs, the same thing is a huge waste of effort. Other than Win32, I know of no system API or cross-platform library that provides both narrow and wide character interfaces. Therefore, in order to support both, you would have to write your own wrappers.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #32
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    The whole point of using _T is to make your program able to compile with both UNICODE and ANSI without any code changes, as the situation requires it.

  3. #33
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Please don't get me started on character encodings in C++.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #34
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Ah, whatever...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  2. from 2D array to 1D array
    By cfdprogrammer in forum C Programming
    Replies: 17
    Last Post: 03-24-2009, 10:33 AM
  3. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM