Skip to main content

IAR Embedded Workbench for RL78 5.20

Extensions overview

In this section:

The compiler offers the features of Standard C and a wide set of extensions, ranging from features specifically tailored for efficient programming in the embedded industry to the relaxation of some minor standards issues.

This is an overview of the available extensions:

  • IAR C language extensions

    For information about available language extensions, see IAR C language extensions. For more information about the extended keywords, see Extended keywords. For information about C++, the two levels of support for the language, and C++ language extensions, see Using C++.

  • Pragma directives

    The #pragma directive is defined by Standard C and is a mechanism for using vendor-specific extensions in a controlled way to make sure that the source code is still portable.

    The compiler provides a set of predefined pragma directives, which can be used for controlling the behavior of the compiler, for example, how it allocates memory, whether it allows extended keywords, and whether it outputs warning messages. Most pragma directives are preprocessed, which means that macros are substituted in a pragma directive. The pragma directives are always enabled in the compiler. For several of them there is also a corresponding C/C++ language extension. For information about available pragma directives, see Pragma directives.

  • Preprocessor extensions

    The preprocessor of the compiler adheres to Standard C. The compiler also makes several preprocessor-related extensions available to you. For more information, see The preprocessor.

  • Intrinsic functions

    The intrinsic functions provide direct access to low-level processor operations and can be useful in, for example, time-critical routines. The intrinsic functions compile into inline code, either as a single instruction or as a short sequence of instructions. For more information about using intrinsic functions, see Mixing C and assembler. For information about available functions, see Intrinsic functions.

  • Library functions

    The DLIB runtime environment provides the C and C++ library definitions in the C/C++ standard library that apply to embedded systems. For more information, see DLIB runtime environment—implementation details.

Note

Any use of these extensions, except for the pragma directives, makes your source code inconsistent with Standard C.

Enabling language extensions

You can choose different levels of language conformance by means of project options:

Command line

IDE*

Description

‑‑strict

Strict

All IAR C language extensions are disabled—errors are issued for anything that is not part of Standard C.

None

Standard

All relaxations to Standard C are enabled, but no extensions for embedded systems programming. For information about extensions, see IAR C language extensions.

‑‑language=extended, ‑e

Standard with extensions>IAR extensions

All IAR C language extensions and many GNU language extensions are enabled.

‑‑language=gnu

Standard with extensions>GNU extensions

Some GNU language extensions are enabled.

Table 68. Language extensions 


* In the IDE, choose Project>Options>C/C++ Compiler>Language 1>Language conformance and select the appropriate option. Note that language extensions are enabled by default in the IDE.