UCS4Char is used for working with 4–byte Unicode characters.Ī string constant of length 1, such as 'A', can denote a character value.The first 256 Unicode characters correspond to the ANSI characters. In the current implementations, WideChar is word-sized (16-bit) characters ordered according to the Unicode character set (note that it could be longer in future implementations). WideChar characters use more than one byte to represent every character.AnsiChar values are byte-sized (8-bit) characters ordered according to the locale character set, which is possibly multibyte.Because the implementation of Char can change in future releases, it is a good idea to use the standard function SizeOf rather than a hard-coded constant when writing programs that may need to handle characters of different sizes. Char in the current implementation is equivalent to WideChar, since now the default string type is UnicodeString.The character types are Char, AnsiChar, WideChar, UCS2Char, and UCS4Char: If compiler range-checking is enabled, however, this code generates a runtime error. For example, the ShortInt type has the range -128.127 hence, after execution of the code: When you increment the last value or decrement the first value of an integer type, the result wraps around the beginning or end of the range. A few routines cannot take Int64 values at all. Also, the Round, Trunc, StrToInt64, and StrToInt64Def functions return Int64 values. However, the High, Low, Succ, Pred, Inc, Dec, IntToStr, and IntToHex routines fully support Int64 arguments. Note: Some standard routines that take integer arguments truncate Int64 values to 32 bits. To get an Int64 return value in this situation, cast I as Int64:įor more information, see Arithmetic Operators. Therefore, the following code produces incorrect results: Operations return a value of type Int64 only when performed on one or more Int64 operands. In general, arithmetic operations on integers return a value of type Integer, which is equivalent to the 32-bit LongInt. Platform-independent integer types include ShortInt, SmallInt, LongInt, Integer, Int64, Byte, Word, LongWord, Cardinal, and UInt64. Platform-independent integer types always have the same size, regardless of what platform you use. Note: 32-bit platforms include 32-bit Windows, 32-bit macOS, 32-bit iOS, iOS Simulator and Android. The following table illustrates their ranges and storage formats for the Delphi compiler. Using these types whenever possible, since they result in the best performance for the underlying CPU and operating system, is desirable. NativeInt, NativeUInt, LongInt, and LongWord. The platform-dependent integer types are transformed to fit the bit size of the current compiler platform. Integer types can be platform-dependent and platform-independent. For example, Inc(I) is equivalent to I := Succ(I) and, if I is an integer variable, to I := I + 1.Īn integer type represents a subset of the integral numbers. The standard procedures Inc and Dec increment and decrement the value of an ordinal variable. Ordinal type identifier or variable of ordinal typeĪlso operates on short-string types and arrays.įor example, High(Byte) returns 255 because the highest value of type Byte is 255, and Succ(2) returns 3 because 3 is the successor of 2. The most important of them are summarized below. Several predefined functions operate on ordinal values and type identifiers. The declaration of an enumerated type can explicitly override this default. For other ordinal types, by default the first value has ordinality 0, the next value has ordinality 1, and so forth. Subrange types maintain the ordinalities of their base types. In most cases, if a value has ordinality n, its predecessor has ordinality n-1 and its successor has ordinality n+1.įor integer types, the ordinality of a value is the value itself. Further, each value has an ordinality, which determines the ordering of the type. An ordinal type defines an ordered set of values in which each value except the first has a unique predecessor and each value except the last has a unique successor. Ordinal types include integer, character, Boolean, enumerated, and subrange types. Simple types - which include ordinal types and real types - define ordered sets of values. Go Up to Data Types, Variables, and Constants Index
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |