Symbian C++ 基础之类的类型和声明
2010-03-22 16:20:00 来源:WEB开发网基本类型
Symbian C++定义了与编译器无关的类型集, 用来代替C++的内建类型. 实际上是在 e32def.h 通过 typedef定义的:
Typedef Type 描述
TInt signed int 一般, 应该使用非特定的 TInt 或者 TUint 类型 , corresponding to signed and unsigned 32-bit integers respectively, unless there is a specific reason to use an 8- or 16-bit variant.
TInt8 signed char
TInt16 short int
TInt32 long int
TUint unsigned int
TUint8 unsigned char
TUint16 unsigned short int
TUint32 unsigned long int
TInt64 long long These use the available native 64-bit support.
TUint64 unsigned long long
TReal32 float Use of floating-point numbers should generally be avoided unless they are a natural part of the problem specification. Many Symbian platform devices do not have a hardware floating-point unit: as a result, their floating-point performance is many times slower than integer performance.
TReal64 double Most serious floating-point calculations require double-precision. All standard math functions (see the Math class) take double-precision arguments. Single-precision should only be used where space and performance are at a premium, and when their limited precision is acceptable.
TReal double
TAny void TAny* is used instead of void* to represent a pointer to an object of unspecified type. Note that void is still used to represent the ‘nothing’ return type.
Thus, we write the following to represent a function taking any object as a parameter and returning nothing:
void TypicalFunction(TAny* aPointerParameter);
in preference to the equivalent:
void TypicalFunction(void* aPointerParameter);
The following is not the same function, because the return type is a pointer to ’something’:
TAny* TypicalFunction(TAny* aPointerParameter);
更多精彩
赞助商链接