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:
Bits 0 through 3, called typ, indicate one of the fundamental types given in ``Fundamental types''.
|T_NULL||0||type not assigned||T_ARG|
|(used only by compiler)||T_CHAR|
|11||member of enumeration||T_UCHAR|
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''.
|DT_NON||0||no derived type|
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:
Here tabptr is a three-dimensional array of pointers to short
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.