TMS34010
C
Language
-
Data
Types
4.2
TMS34010
C
Data
Types
K&R
4.0
-
Equivalent
Types
• The char data type
is
signed. A separate type, unsigned char,
is
sup-
ported.
•
long
and
int
are functionally equivalent types. Either
of
these types can
be declared unsigned.
• double and
long
double are functionally equivalent types.
• The properties
of
enum types
are
identical to those
of
unsigned int.
K&R
4.0
-
Additional
Types
•
An
additional
type,
called void, can be used
to
declare a
function
that
returns no value. The compiler checks that functions declared
as
void
do
not
return values and that they
are
not
used in expressions. Func-
tions
are
the
only
type
of
objects that can be declared void. .
• The compiler also supports a type that
is
a
pointer
to
void
(void
*).
An object
of
type void * can
be
converted to and from a pointer
to
an
object
of
any other type
without
explicit conversions (casts). However,
such a pointer cannot be used indirectly
to
access the object that
it
points
to
without
a conversion. For example,
void
*p,
*malloc();
char
*c;
int
i;
p
p
p
c
i
i
malloc();
c;
&i;
malloc();
*p;
*(int
*)p;
/*
/*
/*
/*
/*
/*
Legal
*/
Legal,
no
cast
needed
Legal,
no
cast
needed
Legal,
no
cast
needed
Illegal,
dereferencing
void
pointer
Legal,
dereferencing
casted
void
pointer
*/
*/
*/
*/
*/
K&R
4.0
-
Derived
Types
4-4
TMS34010
C
allows
any type declaration
to
have
up
to
six
derived
types.
Constructions such
as
pointer
to, array of, and
function
returning can be
combined and applied a maximum
of
six times.
For example:
int
(*
(*n[]
[])
()
)
();
translates
as:
1 }
an
array
of
2}
arrays
of
3) pointers
to
·4)
functions returning
5) pointers
to
6)
functions returning integers
It
has six derived types,
which
is
the maximum allowed.