Wide-character types can be used to represent a character that does not fit into the storage space allocated for a char type. A wide character is stored in a two-byte space. A character constant preceded immediately by an L is a wide-character constant of data type wchar_t (defined in stddef.h). For example:
wchar_t ch = L'A';
When wchar_t is used in a C program it is a type defined in stddef.h header file. In a C++ program, wchar_t is a keyword that can represent distinct codes for any element of the largest extended character set in any of the supported locales. In CodeGear C++, wchar_t is the same size, signedness, and alignment requirement as an unsigned short type.
A string preceded immediately by an L is a wide-character string. The memory allocation for a string is two bytes per character. For example:
wchar_t *str = L"ABCD";
Multi-character constants
The compiler also supports multi-character constants. Multi-character constants can consist of as many as four characters. For example, the constant, '\006\007\008\009' is valid only in a CodeGear C++ program. Multi-character constants are always 32-bit int values. The constants are not portable to other C++ compilers.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|