Storage classes, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 97

Advertising
background image

Storage Classes

Associating identifiers with objects requires each identifier to have at least two
attributes: storage class and type (sometimes referred to as data type). The mikroC
compiler deduces these attributes from implicit or explicit declarations in the
source code.

Storage class dictates the location (data segment, register, heap, or stack) of the
object and its duration or lifetime (the entire running time of the program, or dur-
ing execution of some blocks of code). Storage class can be established by the
syntax of the declaration, by its placement in the source code, or by both of these
factors:

storage-class type identifier

The storage class specifiers in mikroC are:

auto

register

static

extern

Auto

Use the

auto

modifer to define a local variable as having a local duration. This is

the default for local variables and is rarely used. You cannot use

auto

with glob-

als. See also Functions.

Register

By default, mikroC stores variables within internal microcontroller memory. Thus,
modifier

register

technically has no special meaning. mikroC compiler simply

ignores requests for register allocation.

MikroElektronika: Development tools - Books - Compilers

89

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Advertising
This manual is related to the following products: