DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Common Object File Format (COFF)

Type entry

The type field in the symbol table entry contains information about the basic and derived type for the symbol. This information is generated by the C compilation system only if the -g option is used. Each symbol has exactly one basic or fundamental type but can have more than one derived type. The format of the 16-bit type entry is:

d6 d5 d4 d3 d2 d1 typ


Bits 0 through 3, called typ, indicate one of the fundamental types given in ``Fundamental types''.

Fundamental types

Mnemonic Value Type  
T_NULL 0 type not assigned T_ARG
1 function argument    
  (used only by compiler)   T_CHAR
2 character   T_SHORT
3 short integer   T_INT
4 integer   T_LONG
5 long integer   T_FLOAT
6 floating point   T_DOUBLE
7 double word   T_STRUCT
8 structure   T_UNION
9 union   T_ENUM
10 enumeration   T_MOE
11 member of enumeration   T_UCHAR
12 unsigned character   T_USHORT
13 unsigned short   T_UINT
14 unsigned integer   T_ULONG
15 unsigned long  

Bits 4 through 15 are arranged as six 2-bit fields marked d1 through d6. These d fields represent levels of the derived types given in ``Derived types''.

Derived types

Mnemonic Value Type  
DT_NON 0 no derived type  
DT_PTR 1 pointer  
DT_FCN 2 function  
DT_ARY 3 array  

The following examples demonstrate the interpretation of the symbol table entry representing type:

   char *func();
Here func is the name of a function that returns a pointer to a character. The fundamental type of func is 2 (character), the d1 field is 2 (function), and the d2 field is 1 (pointer). Therefore, the type word in the symbol table for func contains the hexadecimal number 0x62, which is interpreted to mean a function that returns a pointer to a character:
   short *tabptr[10][25][3];

Here tabptr is a three-dimensional array of pointers to short integers. The fundamental type of tabptr is 3 (short integer); the d1, d2, and d3 fields each contains a 3 (array), and the d4 field is 1 (pointer). Therefore, the type entry in the symbol table contains the hexadecimal number 0x7f3 indicating a three-dimensional array of pointers to short integers.


Next topic: Type entries and storage classes
Previous topic: Section number and storage class

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003