HP C/iX Reference Manual (31506-90011)
16 Chapter2
Lexical Elements
Identifiers
functions, typedef names, and enumeration constants.
Conceptually, the macro prepass occurs before the compilation of the translation unit. As a
result, macro names are independent from all other names. Use of macro names as
ordinary identifiers can cause unwanted substitutions.
Types
The type of an identifier defines how the identifier can be used. The type defines a set of
values and operations that can be performed on these values. There are three major
category of types in C — object type, function type, and incomplete type.
1. Object Type
There are 3 object types — scalar, aggregate, and union. These are further subdivided
(see figure 2-1).
a. Scalar — These types are all objects that the computer can directly manipulate.
Scalar types include pointers, numeric objects, and enumeration types.
1. Pointer — These types include pointers to objects and functions.
2. Arithmetic — These types include floating and integral types.
• Floating: The floating types include the following:
Float — A 32-bit floating point number. Double — A 64-bit double precision
floating point number. Long double — A 128-bit quad precision floating point
number.
• Integral: The integral types include all of the integer types that the computer
supports. This includes type char, signed and unsigned integer types, and the
enumerated types.
Char — An object of char type is one that is large enough to store an ASCII
character. Internally, a char is a signed integer.
Integer — Integers can be short or long; they are normally signed, but can be
made unsigned by using the keyword unsigned with the type. In C, a
computation involving unsigned operands can never overflow; high-order bits
that do not fit in the result field are simply discarded without warning. A
short int is a 16-bit integer. A long int (or int) is a 32-bit integer. Integer
types include signed char and unsigned char (but not "plain" char).
Enumerated — Enumerated types are explicitly listed by the programmer;
they name specified integer constant values. The enumerated type color
might, for example, define red,
blue, and green. An object of type enum color could then have the value
red, blue, or green.
b. Aggregate — Aggregate types are types that are composed of other types. With
some restrictions, aggregate types can be composed of members of all of the other
types including (recursively) aggregate types. Aggregate types include:
1. Structures — Structures are collections of heterogeneous objects. They are
similar to Pascal records and are useful for defining special-purpose data types.