Jump to main content
MPLAB® XC-DSC C/C++ Compiler User Guide for dsPIC33C/E/F and dsPIC30 DSC
Search
Notice to Development Tools Customers
1
Preface
1.1
GNU Free Documentation License Notice
1.2
Conventions Used in This Guide
1.3
Recommended Reading
1.4
List of Interesting Symbols
2
Compiler Overview
2.1
Device Description
2.2
Device Support via Device Family Packs (DFPs)
2.3
Virtual Device Support
2.4
Compiler Description and Documentation
3
Compiler and Other Development Tools
4
How To's
4.1
Installing the Compiler
4.2
Invoking the Compiler
4.3
Writing Source Code
4.4
Getting My Application to Do What I Want
4.5
Understanding the Compilation Process
4.6
Fixing Code That Does Not Work
5
XC-DSC
Toolchain and Supporting IDEs
5.1
XC-DSC
Language Tools Installation
5.2
MPLAB® X IDE
Setup to Use XC-DSC Language Tools
5.3
MPLAB® for VS Code®
Setup to Use
XC-DSC
Language Tools
5.4
Project Flow
5.5
Operation Summary
5.6
References
5.7
MPLAB X IDE
Project Setup
5.8
MPLAB for VS Code
Project Setup
5.9
Project Examples
6
Compiler Command-Line Driver
6.1
Invoking the Compiler
6.2
The C Compilation Sequence
6.3
The C++ Compilation Sequence
6.4
Runtime Files
6.5
Compiler Output
6.6
Compiler Messages
6.7
Driver Option Descriptions
6.8
MPLAB® X IDE
Toolchain Equivalents
7
Device-Related Features
7.1
Device Support
7.2
Device Header Files
7.3
Stack
7.4
Configuration Bit Access
7.5
Using SFRs
7.6
Bit-Reversed and Modulo Addressing
7.7
Using EDS
7.8
Stack Usage Guidance
8
Differences Between
MPLAB® XC-DSC
and Language Standards
8.1
Divergence from the Language Standards
8.2
Extensions to the Language Standards
8.3
Implementation-Defined Behavior
9
Supported Data Types and Variables
9.1
Identifiers
9.2
Integer Data Types
9.3
Floating-Point Data Types
9.4
Fixed-Point Data Types
9.5
Structures and Unions
9.6
Pointer Types
9.7
Literal Constant Types and Formats
9.8
Standard Type Qualifiers
9.9
Compiler-Specific Type Qualifiers - C
9.10
Compiler-Specific Type Qualifiers - C++
9.11
Variable Attributes
10
Fixed-Point Arithmetic Support
10.1
Enabling Fixed-Point Arithmetic Support
10.2
Data Types
10.3
Rounding
10.4
Division By Zero
10.5
External Definitions
10.6
Mixing C and Assembly Language Code
11
Memory Allocation and Access
11.1
Address Spaces
11.2
Variables In Data Space Memory
11.3
Variables in Program Space
11.4
Parallel Master Port Access
11.5
External Memory Access
11.6
Extended Data Space Access
11.7
Dataflash Memory Access
11.8
Dual Partition Memory Access
11.9
Packing Data Stored in Flash
11.10
Allocation of Variables to Registers
11.11
Variables in EEPROM Data Space (Device Dependent)
11.12
Dynamic Memory Allocation
11.13
Co-Resident Applications
11.14
Memory Models
11.15
Thread Local Storage (TLS)
12
Operators and Statements
12.1
Built-In Functions
12.2
Integral Promotion
13
Register Usage
13.1
Register Variables
13.2
Changing Register Contents
14
Functions
14.1
Writing Functions
14.2
Function Size Limits
14.3
Allocation of Function Code
14.4
Changing the Default Function Allocation
14.5
Inline Functions
14.6
Memory Models
14.7
Function Call Conventions
14.8
Internal Functions
15
Interrupts
15.1
Interrupt Operation
15.2
Writing an Interrupt Service Routine
15.3
Specifying the Interrupt Vector
15.4
Interrupt Service Routine Context Saving
15.5
Nesting Interrupts
15.6
Enabling/Disabling Interrupts
15.7
ISR Considerations
16
Main, Runtime Startup and Reset
16.1
The main Function
16.2
Runtime Startup and Initialization
17
Mixing C/C++ and Assembly Code
17.1
Mixing Assembly Language and C/C++ Variables and Functions
17.2
Using Inline Assembly Language
17.3
Predefined Assembly Macros
18
Library Routines
19
Optimizations
19.1
Optimization Feature Summary
19.2
How to Enable Optimization
19.3
Using Optimizations
20
Preprocessing
20.1
C/C++ Language Comments
20.2
Preprocessing Directives
20.3
Predefined Macro Names
21
Linking Programs
21.1
Default Memory Spaces
21.2
Replacing Library Symbols
21.3
Linker-Defined Symbols
21.4
Default Linker Script
22
C Implementation-Defined Behavior
22.1
Translation
22.2
Environment
22.3
Identifiers
22.4
Characters
22.5
Integers
22.6
Floating Point
22.7
Arrays and Pointers
22.8
Registers
22.9
Structures, Unions, Enumerations and Bit-Fields
22.10
Qualifiers
22.11
Declarators
22.12
Statements
22.13
Preprocessing Directives
22.14
Library Functions
22.15
Signals
22.16
Streams and Files
22.17
tmpfile
22.18
errno
22.19
Memory
22.20
abort
22.21
exit
22.22
getenv
22.23
system
22.24
strerror
23
C++ Implementation-Defined Behavior
24
Embedded Compiler Compatibility Mode
24.1
Compiling in Compatibility Mode
24.2
Syntax Compatibility
24.3
Data Type
24.4
Operator
24.5
Extended Keywords
24.6
Intrinsic Functions
24.7
Pragmas
25
Common C Interface
25.1
Background - The Desire for Portable Code
25.2
Using the CCI
25.3
C Language Standard Refinement
25.4
C Language Standard Extensions
25.5
Compiler Features
26
Diagnostic Pragmas
27
Diagnostic Messages
27.1
Errors
27.2
Warnings
28
GNU Free Documentation License
29
Built-in Functions
29.1
Built-In Functions vs. Inline Assembly
29.2
Built-In Function Descriptions [DD]
30
Document Revision History
30.1
Revision D (June 2026)
30.2
Revision C (August 2025)
30.3
Revision B (April 2024)
30.4
Revision A (October 2023)
Microchip Information
Trademarks
Legal Notice
Microchip Devices Code Protection Feature
DS-50003589D