User manual

Table Of Contents
192
mikoC PRO for PIC32
MikroElektronika
Concepts
This section covers some basic concepts of language, essential for understanding of how C programs work. First, we
need to establish the following terms that will be used throughout the help:
- Objects and lvalues
- Scope and Visibility
- Name Spaces
- Duration
Objects
An object is a specic region of memory that can hold a xed or variable value (or set of values). This use of a term
object is different from the same term, used in object-oriented languages, which is more general. Our deniton of the
word would encompass functions, variables, symbolic constants, user-dened data types, and labels.
Each value has an associated name and type (also known as a data type). The name is used to access the object and
can be a simple identier or complex expression that uniquely refers the object.
Objects and Declarations
Declarations establish a necessary mapping between identiers and objects. Each declaration associates an identier
with a data type.
Associating identiers with objects requires each identier to have at least two attributes: storage class and type
(sometimes referred to as data type). The mikroC PRO for PIC32 compiler deduces these attributes from implicit or
explicit declarations in the source code. Usually, only the type is explicitly specied and the storage class specier
assumes the automatic value auto.
Generally speaking, an identier cannot be legally used in a program before its declaration point in the source code.
Legal exceptions to this rule (known as forward references) are labels, calls to undeclared functions, and struct or union
tags.
The range of objects that can be declared includes:
- Variables
- Functions
- Types
- Arrays of other types
- Structure, union, and enumeration tags
- Structure members
- Union members
- Enumeration constants
- Statement labels
- Preprocessor macros
The recursive nature of the declarator syntax allows complex declarators. You’ll probably want to use typedefs to
improve legibility if constructing complex objects.