![]() |
| | #1 |
| Ugly C Lover Join Date: Jun 2008 Location: Indonesia
Posts: 462
| ...1. Should we use the Unicode functions (e.g. _wfopen, MessageBoxW) in our program? ...2. It seems ANSI char is unsigned char (1 byte) and Wide-char is unsigned int (4 bytes), and by using wide-char in our application will increase memory consumptions. Will it decrease performance too? ...3. Any suggestion and/or reference for this? ...4. Thanks for joining this thread ^_^ EDIT: - Wide-char is unsigned short (2 bytes) - Replaced Wide <-> Unicode Last edited by audinue; 06-20-2008 at 07:22 AM. |
| audinue is offline | |
| | #2 | |||
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,099
| Quote:
They work with many international characters ANSI does not. And in these days and times, that's an important thing. Quote:
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |||
| Elysia is offline | |
| | #3 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| Actually, since the NT WinAPI works with wide strings internally no matter what (and will convert your narrow strings if you pass them to any API function), using wide characters is likely to be faster.
__________________ 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 |
| CornedBee is offline | |
| | #4 |
| and the hat of sweating Join Date: Aug 2007 Location: Toronto, ON
Posts: 3,122
| For production code I'd recommend using Unicode strings, even if you don't have any immediate plans for non-English language support. For simple test utilities that probably won't be around for very long, ANSI should be fine if you only need English, but Unicode might still be better since you never know when your simple test utility might become popular and used a lot more. |
| cpjust is offline | |
| | #5 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,099
| Making your application both ANSI/Unicode safe from the start is what I do. Using TCHAR and _T or TEXT around your strings will make sure your application will compile as either Unicode or ANSI. Sometimes you may want to switch between the two, and when that moment comes, you'll be fine.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
![]() |
| Tags |
| memory, wide characters, windows |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unicode v ANSI Calls | Davros | Windows Programming | 3 | 04-18-2006 09:35 AM |
| how closely does vc++.net 2003 follow ANSI? | krygen | C++ Programming | 7 | 09-22-2004 06:48 PM |
| Wide string to Ansi String | Davros | C++ Programming | 7 | 08-08-2004 08:40 AM |
| sigaction() and ANSI C | awoodland | Linux Programming | 4 | 04-25-2004 01:48 AM |
| converting Ansi String to double or constant char* value (strtod?) | kes103 | C++ Programming | 5 | 10-09-2002 12:37 PM |