54
Section 2: Compiler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
declarations. The Sierra C compiler treats bit fields as unsigned objects by
default. The signed keyword can be used to treat bit fields as signed objects.
2.7. Constants
The C compiler recognizes four types of constants: floating-point, integer,
character, and enumeration. Every constant has a type that is determined by its
form and value, as described in this section. All constants are non-negative in the
absence of overflow. If there is a minus sign preceding a constant, it is
recognized as a unary operator applied to the constant, and not as part of the
constant itself.
2.7.1. Floating-Point
Constants
A floating-point constant may be written with a decimal point, a signed exponent,
and/or a type specifier suffix. The exponent consists of the letter
e
or
E
followed
by an optionally signed decimal constant. The type specifier is one of the letters
f
,
F
,
l
, or
L
. Either the decimal point or the exponent must be present for the
constant to be recognized as a floating-point type.
Examples of floating-point constants include:
0.
5e9
3.1415
1.0
5E+9l
0.31415E1F
.0
5e+9L
31415.e-4
.1
.50e-8
31415e-4f
The digit sequences are interpreted as decimal numbers. The exponent indicates
the power of 10 by which the value to the left of the exponent is to be multiplied.
Note:
All floating-point constants, whether they are written with a suffix or without a suffix, are
of type double (10 byte TI BCD floating point).
2.7.2. Integer
Constants
An integer constant begins with a decimal digit and contains no decimal point or
exponent. It can have a prefix that specifies its base and a suffix that specifies its
type. The type specifiers are the letters
u
,
U
,
l
, and
L
, where
u
(or
U
) and
l
(or
L
)
can be used together in either order. The
u
(or
U
) specifier coerces the constant
to an unsigned type, and the
l
(or
L
) specifier coerces the constant to a long
int.