Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Basic Types Overview


Purpose

Provides implementation-independent versions of the C++ built-in types, defines the EPOC standard base class for all heap-allocated classes, and provides some useful yet simple global functions.

You should avoid using the C++ built-in types directly: always use the EPOC types instead.

[Top]


Description

The API defines classes and typedefs for integer, text, Boolean, and floating point types. Additionally, a utility class to help with reference arguments in variable argument functions is provided.


Heap-allocated classes base

EPOC requires that all classes that own dynamically allocated resources derive from a standard base class, CBaseCBase. Such classes by conventions have a C prefix to their name, and so are referred to as C classes. C classes, and their associated allocation and cleanup idioms, are fundamental to EPOC.


Integral types

TInt is the natural machine word integer and should be used in all general contexts where integer arithmetic is desired.

TInt32, TInt16 and TInt8 map onto C++ built-in types in most implementations. These types should only be used where the size of the integer is of first importance.

TUint is an unsigned integer of the natural machine word size. It should be used for flag and handle words, which are manipulated using bitwise and equality-comparison operations rather than arithmetic.

TUint32, TUint16 and TUint8 are available where the specific representation width is important.


Text types

TText represents a character in the natural character width for the EPOC build. For Unicode builds, this is 16 bits.

TText8 is available for build-independent 8-bit characters, and TText16 for build-independent 16-bit characters.

The TChar class wraps a character value and provides a number of utility functions to operate upon it.


Boolean type

TBool represents a Boolean whose value may be true or false. It is implemented as a natural machine-word integer.


Floating-point types

TReal is a 64-bit double-precision type, used as the argument type for all math functions, and the default type of floating-point literals.

TReal64 and TReal32 are available when the precise size is important.


Value reference type

The value reference type is a utility that is provided to overcome problems with specifying a C++ reference argument before the ellipsis argument in variable argument functions.

The value reference type is provided by TRefByValue<T>.


Global functions

Max(), Min(), Rng() and Abs() are simple global functions that are useful in many contexts.

[Top]


See also

Maths Overview