User manual

MPLAB
®
XC8 C COMPILER
USERS GUIDE
2012 Microchip Technology Inc. DS52053B-page 131
Chapter 5. C Language Features
5.1 INTRODUCTION
MPLAB XC8 C Compiler supports a number of special features and extensions to the
C language which are designed to ease the task of producing ROM-based applications
for 8-bit PIC devices. This chapter documents the special language features which are
specific to these devices.
ANSI C Standard Issues
Device-Related Features
Supported Data Types and Variables
Memory Allocation and Access
Operators and Statements
Register Usage
Functions
Interrupts
Main, Runtime Startup and Reset
Library Routines
Mixing C and Assembly Code
Optimizations
Preprocessing
Linking Programs
5.2 ANSI C STANDARD ISSUES
This compiler conforms to the ISO/IEC 9899:1990 Standard for programming lan-
guages. This is commonly called the C90 Standard. It is referred to as the ANSI C
Standard in this manual.
Some violations to the ANSI C Standard are indicated below in
Section 5.2.1 “Divergence from the ANSI C Standard”. Some features from the
later standard C99 are also supported.
5.2.1 Divergence from the ANSI C Standard
The C language implemented on MPLAB XC8 C Compiler diverges from the ANSI C
Standard in one area: function recursion. Due to limited memory and no hardware
implementation of a data stack, recursion is not supported and functions are not
reentrant.
The compiler can make functions called from main-line and interrupt code appear to be
reentrant via a duplication feature. See Section 5.9.5 “Function Duplication”.
5.2.2 Implementation-Defined behavior
Certain features of the ANSI C standard have implementation-defined behavior. This
means that the exact behavior of some C code can vary from compiler to compiler. The
exact behavior of the compiler is detailed throughout this manual, and is fully
summarized in Appendix C. “Implementation-Defined Behavior”.