EasyManuals Logo
Home>Texas Instruments>Computer Hardware>TMS34010

Texas Instruments TMS34010 User Manual

Texas Instruments TMS34010
128 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #34 background imageLoading...
Page #34 background image
The
TMS34010
C Language
4.7.4
Enumeration
Declarations
Addi-
tional
Enumerations
allow
the use
of
named integer constants in
TMS34010
C.
The
syntax
of
an
enumeration declaration
is
very similar
to
that
of
a structure
or
union. The keyword enum
is
substituted
for
struct
or
union, and a list
of
enu-
merators
is
substituted
for
the list
of
members.
Enumeration declarations have a
"tag",
as
do
structure and union declarations.
This tag may be used in future declarations,
without
repeating the entire dec-
laration.
The list
of
enumerators
is
simply a comma-separated list
of
identifiers.
Each
identifier may be either alone
or
followed
by
an
equal sign and
an
integer
constant.
If
no
enumerators
with
"="
appear, then the values
of
the successive
enumerators begin at zero and increase
by
one
for
each identifier. An identifier
with
an
assigned value assumes
that
value, -and subsequent enumerators
continue
counting
by
one from there. The assigned value may
be
negative,
but
counting
still continues
by
positive one.
An object
of
type enum has a size determined
as
follows:
if
any
of
the object's
enumerators have negative values, the object occupies
32
bits. Otherwise, the
object occupies the minimum number
of
bits required
to
represent the largest
enumerator value
and
is
considered
to
be unsigned.
Unlike structure and union members, enumerators share their name space
with
ordinary variables and, therefore, must
not
conflict
with
variables
or
other en-
umerators in the same scope.
Enumerators may appear wherever integer constants are required
and, there-
fore, can participate in arithmetic expressions, case expressions, and so forth.
In addition, explicit integer expressions may be assigned
to
variables
of
type
enum. The compiler does no range checking
to
insure the value
will
fit
in the
enumeration field. The compiler does, however, issue a warning message
if
an
enumerator
of
one type
is
assigned
to
a variable
of
another.
Example:
enum
color
(red,blue,green=10,orange,purple=-2,cyan}
x;
This statement declares x
as
a variable
of
type enum The enumerators
(with
their values in parentheses)
are:
red
(0),
blue
(1),
green
(10),
orange
(11),
purple
(-2),
cyan
(-1).
The variable x is allocated
32
bits because
of
the ne-
gative values.
All
the
following
are legal operations:
x =
blue;
x =
blue
+
red;
x
100;
ired;
/*assume
i
has
been
declared
an
int*/
x = i +
cyan;
4-7

Table of Contents

Other manuals for Texas Instruments TMS34010

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TMS34010 and is the answer not in the manual?

Texas Instruments TMS34010 Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS34010
CategoryComputer Hardware
LanguageEnglish

Related product manuals