Basic Types Overview

This document is an overview of the basic types.

Purpose

Provides implementation-independent versions of the C++ built-in types, defines the Symbian platform 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 Symbian platform types instead.

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

Symbian platform requires that all classes that own dynamically allocated resources derive from a standard base class, CBase . 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 Symbian platform.

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 width for the Symbian platform build. From v5.1 onwards, 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.