Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.
Language Options in TI Compilers
Note that this page only applies starting with the following releases:
See Production Compiler Releases for information on release availability.
Choosing a Language Option Set
The language mode in the TI compiler is a function of two options:
- The dialect, or what language standard to use
- The strictness, which is how the standard is interpreted.
Generally, the default mode should be sufficient for most applications, but in other cases, the application may have been written with a different language or behavior in mind.
The default mode is a nonstrict C89 mode. Extensions to this mode can be found here.
Choosing a Dialect
The first choice that should be made is what C or C++ dialect the program should be compiled under. A list of standard dialects TI supports can be found here.
- C Dialects
- C89 (--c89, default for C files)
- C99 (--c99)
- K&R C (--kr_compatible or -pk)
- C++ Dialects
- C++03 (--c++03, default for C++ files and C files under -fg)
- Embedded C++ (-pe)
If it is known under which standard an application or file was written, it's a good practice to use that dialect while compiling. However, if this is not known, then most often times the default will suffice. This is especially true for the default C mode under relaxed strictness, which incorporates many extensions from C99 into the C89 implementation.
For C++, the embedded C++ implementation is a subset of C++03 which disables many features for simplification and speed purposes. More information can be found at its Wikipedia entry. As it's just a subset, the default C++03 mode will compile any Embedded C++ application.
Choosing a Strictness Mode
The next choice is how strict the implementation should conform to the dialect chosen above.
- Strictness modes
- Relaxed (-pr, default)
- Strict (-ps)
Two pages describe the relaxed mode:
- Under relaxed C modes, GCC Extensions are enabled in both C89 and C99 dialect modes
- In C89 mode, extensions originating as C99 features are enabled.
In addition, many code constructs which result in an error in strict conformance mode are instead accepted silently where possible, or result in a warning rather than an error.
Under strict C modes, extensions are disabled barring one important feature, GCC-style attributes.
Keywords standard in C99 mode such as "inline" and "restrict" are disabled in C89 mode, but reserved replacements are provided in the form of double underlined versions, "__inline" and "__restrict". If a C89 program leverages these nonstandard keywords, adding a predefined macro mapping the keyword to its double underline twin (e.g. -Dinline=__inline) will allow the feature silently in strict mode.
The goal of strict mode is to allow for maximum portability to the TI compiler. If a program compiles in strict mode with any other compiler, it should compile with the TI compiler under strict mode.
A variety of issues may arise due to updating from an older version of the compiler to one which has the above language modes.