HP C/iX Reference Manual (31506-90011)

Chapter 4 53
Type Conversions
Arithmetic Conversions
i = -9.99; /* i gets the value -9 */
float x1 = 1e38; /* legal; double is converted to float */
float x2 = 1e39; /* illegal; value is outside of range */
/* for float */
long double x3 = 1.f; /* legal; float is converted to long */
/* double */
When a long double value is converted to a double or float value, or a double value is
converted to a float value, if the original value is within the range of values representable
in the new type, the result is the nearest representable value (if it cannot be represented
exactly). If the two nearest representable values are equally near, the result is the one
whose least significant bit is zero. When a float value is converted to a double or long
double value, or a double value is converted to a long double value, the value is unchanged.
Arrays, Pointers, and Functions
An expression that has function type is called a function designator. For example, a
function name is a function designator. With two exceptions, a function designator with
type "function returning type" is converted to an expression with type "pointer to function
returning type." The exceptions are when the function designator is the operand of sizeof
(which is illegal) and when it is the operand of the unary & operator.
In most cases, when an expression with array type is used, it is automatically converted to
a pointer to the first element of the array. As a result, array names and pointers are often
used interchangeably in C. This automatic conversion is not performed in the following
contexts:
When the array is the operand of sizeof or the unary &.
When the array is a character string literal initializing an array of characters.
When the array is a wide string literal initializing an array of wide characters.