-T: Flexible Type Management

Group

LANGUAGE.

Scope

Application

Syntax
  -T<Type Format> 
  
Arguments

<Type Format>: See below

Default

Depends on target, see Compiler Backend

Defines

To deal with different type sizes, the Compiler predefines one of the following define groups (refer the following listing).

Listing: 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_IEEE64__


__FLOAT_IS_DSP__


__DOUBLE_IS_IEEE32__


__DOUBLE_IS_IEEE64__


__DOUBLE_IS_DSP__


__LONG_DOUBLE_IS_IEEE32__


__LONG_DOUBLE_IS_IEEE64__


__LONG_DOUBLE_IS_DSP__


__LONG_LONG_DOUBLE_IS_IEEE32__


__LONG_LONG_DOUBLE_IS_IEEE64__


__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 syntax of the option is: -T{<type><format>}

Note: Flexible type management does not support 8-bit int definitions. When generating code, use minimal startup code instead of ANSI startup code.

For <type>, specify one of the keys listed in the following table.

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, for example, both ' f' and ' F' may be used for the type " float".

Change the sign of type char or of the enumeration type with a prefix placed before the key for the char key. Refer the following table.

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

Change the sign of the plain bitfield type with the options shown in the following table. Plain bitfields are bitfields defined or declared without an explicit signed or unsigned qualifier, for example, int field:3. Using this option, you can specify whether to handle the int in the previous example as signed int or as unsigned int.

Note: This option may not be available on all targets. Also the default setting may vary. For more information, refer to the topic 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>, specify one of the keys in the following table.

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'
IEEE64 floating '4'
DSP (32-bit) '0'

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

Note: At least one type for each basic size (1, 2, 4 bytes) must be available. You must set a size for all types, at least equal to one. See Backend for default settings.
Note: Enumeration types have the type ` signed int' by default for ANSI-C compliance.

Use the -Tpmo option to change the pointer to a member offset value type. The default setting is 16 bits. The Compiler uses the pointer to the member offset as a C++ pointer to members only.

-Tsc sets ´ char´ to ´ signed char´

and -Tuc sets ´ char´ to ´ unsigned char´

Listing: Example


-Tsc1s2i2L4LL4f2d4Ld4LLd4e2 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)

  double, long double and long long double with IEEE64 (d4Ld4LL4)

  enum with 16 bits (signed) (e2)
Listing: Restrictions


For integrity and ANSI compliance, the following rules must be true:
  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: Do not set char to 16 bits and int to 8 bits.

Change type sizes with caution. Type sizes must be consistent over the whole application. The libraries delivered with the Compiler are compiled with the standard type settings.

Use caution when changing type sizes for under or overflows (for example, assigning a large value to a small object), as shown in the following example:

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

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

  
Example

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 and double to IEEE64:

  -Tf2d4

  

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

You can also set this option using the dialog box in the Graphical User Interface.

See also

Sign of Plain Bitfields