-T: Flexible Type Management

Group

LANGUAGE.

Scope

Application

Syntax
-T<Type Format>

Arguments

<Type Format>: See below

Default

Depends on target, see the Backend chapter

Defines

To deal with different type sizes, one of the following define groups in the following listing is predefined by the Compiler:

Listing: Predefined define groups



__CHAR_IS_SIGNED__

__CHAR_IS_UNSIGNED__


__CHAR_IS_8BIT__


__CHAR_IS_16BIT__


__CHAR_IS_32BIT__


__CHAR_IS_64BIT__


__SHORT_IS_8BIT__


__SHORT_IS_16BIT__


__SHORT_IS_32BIT__


__SHORT_IS_64BIT__


__INT_IS_8BIT__


__INT_IS_16BIT__


__INT_IS_32BIT__


__INT_IS_64BIT__


__ENUM_IS_8BIT__


__ENUM_IS_16BIT__


__ENUM_IS_32BIT__


__ENUM_IS_64BIT__


__ENUM_IS_SIGNED__ 


__ENUM_IS_UNSIGNED__


__PLAIN_BITFIELD_IS_SIGNED__ 


__PLAIN_BITFIELD_IS_UNSIGNED__


__LONG_IS_8BIT__


__LONG_IS_16BIT__


__LONG_IS_32BIT__


__LONG_IS_64BIT__


__LONG_LONG_IS_8BIT__


__LONG_LONG_IS_16BIT__


__LONG_LONG_IS_32BIT__


__LONG_LONG_IS_64BIT__


__FLOAT_IS_IEEE32__


__FLOAT_IS_DSP__


__DOUBLE_IS_IEEE32__


__DOUBLE_IS_DSP__


__LONG_DOUBLE_IS_IEEE32__


__LONG_DOUBLE_IS_DSP__


__LONG_LONG_DOUBLE_IS_IEEE32__


__LONG_LONG_DOUBLE_DSP__


__VTAB_DELTA_IS_8BIT__


__VTAB_DELTA_IS_16BIT__


__VTAB_DELTA_IS_32BIT__


__VTAB_DELTA_IS_64BIT__


__PTRMBR_OFFSET_IS_8BIT__


__PTRMBR_OFFSET_IS_16BIT__


__PTRMBR_OFFSET_IS_32BIT__


__PTRMBR_OFFSET_IS_64BIT__
Pragmas

None

Description

This option allows configurable type settings. The option syntax is:

-T{<type><format>}

For <type>, one of the keys listed in the following table may be specified:

Table 1. Data Type Keys
Type Key
char c
short s
int i
long L
long long LL
float f
double d
long double Ld
long long double LLd
enum e
sign plain bitfield b
virtual table delta size vtd
pointer to member offset size pmo
Note: Keys are not case-sensitive, e.g., both f or F may be used for the type float.

The sign of the type char or of the enumeration type may be changed with a prefix placed before the key for the char key. Refer to the following table:

Table 2. Keys for Signed and Unsigned Prefixes
Sign Prefix Key
signed s
unsigned u

The sign of the type plain bitfield type is changed with the options shown in the following table. Plain bitfields are bitfields defined or declared without an explicit signed or unsigned qualifier, e.g., int field:3. Using this option, you can specify if the int in the previous example is handled as signed int or as unsigned int. Note that this option may not be available on all targets. Also the default setting may vary. For more information, refer to the Sign of Plain Bitfields.

Table 3. Keys for Signed and Unsigned Bitfield Prefixes
Sign prefix Key
plain signed bitfield bs
plain unsigned bitfield bu

For <format>, one of the keys in the following table can be specified.

Table 4. Data Format Specifier Keys
Format Key
8-bit integral 1
16-bit integral 2
24-bit integral 3
32-bit integral 4
64-bit integral 8
IEEE32 floating 2
DSP (32-bit) 0

Not all formats may be available for a target. See RS08 Backend for supported formats.

Note: At least one type for each basic size (1, 2, 4 bytes) has to be available. It is illegal if no type of any sort is not set to at least a size of one. See RS08 Backend for default settings.
Note: Enumeration types have the type signed int by default for ANSI-C compliance.

The -Tpmo option allows you to change the pointer to a member offset value type. The default setting is 16 bits. The pointer to the member offset is used for C++ pointer to members only.

Examples
-Tsc sets ´char´ to ´signed char´ 

and

-Tuc sets ´char´ to ´unsigned char´

Listing: -Tsc1s2i2L4LL4f2e2 denotes:


  signed char with 8 bits (sc1)
  short and int with 16 bits (s2i2)

  long, long long with 32 bits (L4LL4)

  float with IEEE32 (f2)

  enum with 16 bits (signed) (e2)

For integrity and compliance to ANSI, the following two rules must be true:

Listing: Restrictions


  sizeof(char)        <= sizeof(short)
  sizeof(short)       <= sizeof(int)

  sizeof(int)         <= sizeof(long)

  sizeof(long)        <= sizeof(long long)

  sizeof(float)       <= sizeof(double)

  sizeof(double)      <= sizeof(long double)

  sizeof(long double) <= sizeof(long long double)
Note: It is not permitted to set char to 16 bits and int to 8 bits.

Be careful if you change type sizes. Type sizes must be consistent over the whole application. The libraries delivered with the Compiler are compiled with the standard type settings.

Also be careful if you change the type sizes for under or overflows, e.g., assigning a value too large to an object which is smaller now, as shown in the following example:

int i; /* -Ti1 int has been set to 8 bits! */

i = 0x1234; /* i will set to 0x34! */

Examples

Setting the size of char to 16 bits:

-Tc2

Setting the size of char to 16 bits and plain char is signed:

-Tsc2

Setting char to 8 bits and unsigned, int to 32 bits and long long to 32 bits:

-Tuc1i4LL4

Setting float to IEEE32:

-Tf2

The -Tvtd option allows you to change the delta value type inside virtual function tables. The default setting is 16-bit.

Another way to set this option is using the dialog box in the Graphical User Interface:

Figure 1. Standard Types Settings Dialog Box
Standard Types Settings Dialog Box
See also

Sign of Plain Bitfields