User manual

mikroC PRO for dsPIC
MikroElektronika
199
Types
The mikroC PRO for dsPIC30/33 and PIC24 is a strictly typed language, which means that every object, function,
and expression must have a strictly dened type, known in the time of compilation. Note that the mikroC PRO for
dsPIC30/33 and PIC24 works exclusively with numeric types.
The type serves:
- to determine the correct memory allocation required,
- to interpret the bit patterns found in the object during subsequent accesses,
- in many type-checking situations, to ensure that illegal assignments are trapped.
The mikroC PRO for dsPIC30/33 and PIC24 supports many standard (predened) and user-dened data types, including
signed and unsigned integers in various sizes, oating-point numbers with various precisions, arrays, structures, and
unions. In addition, pointers to most of these objects can be established and manipulated in memory.
The type determines how much memory is allocated to an object and how the program will interpret the bit patterns
found in the object’s storage allocation. A given data type can be viewed as a set of values (often implementation-
dependent) that identiers of that type can assume, together with a set of operations allowed with these values. The
compile-time operator sizeof allows you to determine the size in bytes of any standard or user-dened type.
The mikroC PRO for dsPIC30/33 and PIC24 standard libraries and your own program and header les must provide
unambiguous identiers (or expressions derived from them) and types so that the mikroC PRO for dsPIC can
consistently access, interpret, and (possibly) change the bit patterns in memory corresponding to each active object in
your program.
Type Categories
A common way to categorize types is to divide them into:
- fundamental
- derived
The fudamental types represent types that cannot be split up into smaller parts. They are sometimes referred to as
unstructured types. The fundamental types are void, char, int, oat, and double, together with short, long,
signed, and unsigned variants of some of them. For more information on fundamental types, refer to the topic
Fundamental Types.
The derived types are also known as structured types and they include pointers to other types, arrays of other types,
function types, structures, and unions. For more information on derived types, refer to the topic Derived Types.