Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: e32def.h

Typedef TInt

typedef signed int TInt;

Support

Supported from 5.0

Description

Signed integer type of the natural machine word length. This is as defined by the C++ implementation’s int type. In all implementations, this is guaranteed to be at least 32 bits.

A TInt should be used in preference to a sized integer (TInt32, TInt16) for all general use. Sized integers should only be used when packing is essential. C++’s type conversion rules imply that all sized integers smaller than the natural machine word are in any case broadened to the natural machine word size when passed as function parameters.

A TInt should be used in preference to an unsigned integer (TUint) for all general use. Unsigned integers should only be used for flags (which use Boolean operations but not arithmetic) and, in very rare cases, for numbers whose range exceeds that available from signed integers. Although it is natural to attempt to use unsigned integers for quantities which cannot by nature be negative, the C++ language does not provide the support necessary to enforce the "expected" behaviour in these circumstances, and experience has shown that it is better to use signed integers unless there is good reason not to.

See also: