From Ansi Char to Wide Char

For some time, Delphi included two separate data types representing characters:

  • AnsiChar, with an 8-bit representation (accounting for 256 different symbols), interpreted depending on your code page;
  • WideChar, with a 16-bit representation (accounting for 64K different symbols)22.

In this respect, nothing has changed in Delphi 2009. What is different is that the Char type used to be an alias of AnsiChar and is now an alias of WideChar. Every time the compiler sees Char in your code, it reads WideChar. Notice that there is no way to change this new compiler default23.

This is quite a change, impacting a lot of source code and with many ramifications. For example, the PChar pointer is now an alias of PWideChar, rather than PAnsiChar, as it used to be. We'll see how this affects the calls to Windows API functions in a later section in this chapter.

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment