TMS34010
C
Language
-
Declarations
4.6
Declarations
K&R
8.1
-
Register
Variables
o A
function
can have a maximum
of
eight register variables; the
limit
ap-
plies
to
the combination
of
register arguments and local register vari-
ables.
o
Any
scalar type variable that
is
less than 32 bits (such
as
int, float,
or
pointer) can be declared
as
a register. Other types (such
as
struct,
double, or arrays) cannot
be
declared
as
registers.
o A register declaration
of
an
invalid type or a declaration after the first
eight registers have been declared
is
treated
as
a normal auto declaration.
o Function arguments can be declared
as
type register. Such arguments
are
passed on the stack in the normal way; the
function
pops them
off
into registers and they
are
treated like normal register variables
for
the
duration
of
the function.
/(&R
8.2
-
Type
Specifiers
in
Declarations
o In addition
to
the type-specifiers listed in
K&R,
objects may be declared
with
enum specifiers.
o
TMS34010
C allows
more
type
name
combinations
than
K&R
C.
The adjectives long and short can be used
with
or
without
the
word
int;
the meaning
is
the same in either case. The
word
unsigned can be used
in
conjunction
with
any integer type or alone;
if
alone, int
is
implied.
long float
is
a synonym
for
double. Otherwise,
only
one type specifier
is
allowed in a declaration.
/(&R
8.4
-
Passing/Returning
Structures
to/from
Functions
o Contrary
to
K&R,
TMS3401 0 C allows functions
to
return structures and
unions.
o Structures and unions can be used
as
function
parameters and can be
directly assigned.
/(
&R
10 -
External
Definitions
Formal parameters to a
function
may be declared
as
type struct, union,
or
enum (in addition
to
the normal
function
declarations), since
TMS34010
C
allows you
to
pass such objects
to
functions.
/(&R
8.5,
K&14.1 -
Structure
and
Union
Declarations
4-8
o Since the
TMS34010
is
bit-addressable, structure members
are
not
aligned in any way. The statement in
K&R
about alignment or bounda-
ries for structure members
does
not
apply to
TMS34010
C.
Any
field
with
width
zero (normally used
to
force alignment) is ignored. However,
bit
fields
are
limited
to
a
width
of
32
bi~s.
o
Any
integer type may be declared
as
a field. Fields are treated
as
signed
unless declared otherwise. Also, contrary to
K&R,
pointers
to
fields are
legal in
TMS3401 0
C.