Microchip Technology SW006022-2N Data Sheet
MPLAB
®
XC16 C COMPILER
USER’S GUIDE
2012 Microchip Technology Inc.
DS52071B-page 149
Chapter 10. Functions
10.1
INTRODUCTION
The compiler supports C code functions and handles assembly code functions, as dis-
cussed in the following topics:
cussed in the following topics:
10.2
WRITING FUNCTIONS
Implementation and special features associated with functions are discussed in the fol-
lowing sections.
lowing sections.
10.2.1
Function Specifiers
The only specifier that has any effect on functions is static.
A function defined using the static specifier only affects the scope of the function, i.e.
limits the places in the source code where the function may be called. Functions that
are static may only be directly called from code in the file in which the function is
defined. This specifier does not change the way the function is encoded.
limits the places in the source code where the function may be called. Functions that
are static may only be directly called from code in the file in which the function is
defined. This specifier does not change the way the function is encoded.
10.2.2
Function Attributes
The keyword __attribute__ allows you to specify special attributes when making a
declaration. This keyword is followed by an attribute specification inside double
parentheses. The following attributes are currently supported for functions:
declaration. This keyword is followed by an attribute specification inside double
parentheses. The following attributes are currently supported for functions:
• boot
• const
• far
• near
• noload
• noreturn