23 C++ Implementation-Defined Behavior
This section offers implementation-defined behavior of the MPLAB® XC-DSC C/C++ Compiler for dsPIC33A DSC. The ISO standard for C++ requires that vendors document the specifics of “implementation defined” features of the language.
| ISO Standard | Implementation |
|---|---|
| Which of the compiler's output messages are diagnostic messages (1.3.6) | |
All output to stderr is a
diagnostic. | |
| The required libraries for a freestanding implementation (1.4) | |
| See the response for The set of headers for a freestanding implementation (17.6.1.3). | |
| The number of bits in a byte (1.7) | |
| 8 bits | |
| What constitutes an interactive device (1.9) | |
If isatty() is true, then
interactive stream support is implied. | |
| The number of threads in a program under a freestanding implementation (1.10) | |
| Threads are not directly supported. | |
| How physical source file characters are mapped to the basic source character set (2.2) | |
| The locale settings determine the default source character set or UTF-8 if this cannot be determined by the locale. The basic source character set is UTF-8. | |
| Physical source file characters (2.2) | |
Defaults to the set locale and if that
doesn’t work, defaults to UTF-8. Can be any
encoding supported by the system’s
iconv() library routine. | |
| The execution character member chosen for a source character that does not map to an equivalent execution character. (2.2) | |
| ABI Defined | |
| Whether source of translation units must be available to locate template definitions (2.2) | |
| The source must be available. | |
| The execution character-set and execution wide-character set (2.3) | |
The execution character set contains
[a-zA-Z0-9_{}[]#()<>%:;.?*+-/^&|∼!=,\"’],
space, control characters representing horizontal
tab, vertical tab, form feed, new-line, alert,
backspace, carriage return, and a null character.
The execution wide-character set is the same,
except instead of a null character it has a null
wide character. Encoding can be anything supported
by the system’s iconv() library
routine, defaulting to UTF-8 (or UTF-32, for the
wide-character set). | |
| The mapping header name to header or external source file (2.9) | |
| Same name as the header, in UTF-8. | |
| The encoding of universal character name not in the execution character set (2.14.3) | |
\UNNNNNNNN
or \uNNNN, where
N is a hex-quad,
corresponding to the character short name in
ISO/IEC 10646
NNNNNNNN or
0000NNNN,
respectively. | |
| The semantics of non-standard escape sequences (2.14.3) | |
As an extension, GCC supports the sequence
'\e' to act as the ASCII
ESC character. | |
| The value of a character literal outside the range of the corresponding type (2.14.3) | |
| The last byte of the series of bytes making up the literal. | |
| The wide-character literal with single c-char that is not in execution wide-character set (2.14.3) | |
| The last four bytes of the series of bytes making up the literal. | |
| The choice of a larger or smaller value of floating literal when the value is not in the range of representable values for its type (2.14.4) | |
| As per Annex F of C99. | |
| The concatenation of string literals other than those fully specified by the standard (2.14.5) | |
| No extra concatenations are supported. | |
| Whether all string literals are distinct (that is, are stored in non-overlapping objects) (2.14.5) | |
| String literals are not necessarily distinct. | |
The linkage of
main() (3.6.1) | |
| External linkage. | |
| The parameters to main (3.6.1) | |
or
| |
| What constitutes start-up and termination in freestanding environment (3.6.1) | |
Determined by the device-specific startup
code. The default code shipped in a DFP calls
constructors before main() for
objects of namespace scope with static storage
duration but does not call destructors after
return from main(). | |
| Whether defining main is required in a freestanding environment (3.6.1) | |
Yes - The device-specific startup code can
be customized to not call main(),
but some features such as the stack-usage report
require main(). | |
| Whether dynamic initialization of a non-local variable with static or thread storage duration is done before the first statement of the initial function of the thread (3.6.2) | |
| Threads are not directly supported. | |
Whether dynamic
initialization of a non-local variable with static
storage duration is done before the first
statement of main()
(3.6.2) | |
| Determined by the device-specific startup code, but the default startup code provided in a DFP does call the constructors. | |
| Whether an implementation has relaxed or strict pointer safety (3.7.4.3) | |
| Relaxed pointer safety. | |
| The extended signed integer types (3.9.1) | |
| None | |
The representation
of char (3.9.1) | |
| One byte. | |
The signedness of
a plain char (3.9.1) | |
A plain char is
unsigned. | |
| The value representation of floating-point types (3.9.1) | |
| IEEE-754 | |
| The value representation of pointer types (3.9.2) | |
| 32 bits. | |
| The number of bytes between successive addresses at which a given object can be allocated alignment (3.11) | |
| Valid alignments are powers of 2 up to and including 228. | |
| Whether any extended object alignments are supported and the contexts in which they are supported (3.11) | |
| Extended alignments up to 228 are allowed, subject to the device memory layout. | |
| The value of the result of unsigned to signed conversion (4.7) | |
| For conversion to a type of width N, the value is reduced modulo 2N to be within range of the type. | |
| The result of an inexact floating-point conversion (4.8) | |
| Software emulation uses Round to Nearest but the mode can be changed when using a hardware FPU. | |
| The value of result of inexact integer to floating-point conversions (4.9) | |
| As per C99 Annex F. | |
| The rank of extended signed integer type (4.13) | |
| Extended signed integer types are not supported. | |
| Passing an argument of class type through ellipsis (5.2.2) | |
| Supported | |
The class publicly
derived from std::type_info which
can be returned by typeid
(5.2.8) | |
No extra class is defined. The result is
std::type_info. | |
| The conversions between pointers and integers (5.2.10) | |
| A cast from an integer to a pointer or vice
versa uses the binary representation of the source
type, reinterpreted as appropriate for the
destination type. If the source type is larger than the destination type, the Most Significant bits are discarded. When casting from a pointer to an integer, if the source type is smaller than the destination type, the result is sign extended. When casting from an integer to a pointer, if the source type is smaller than the destination type, the result is extended based on the signedness of the source type. | |
| The meaning of converting a function pointer to an object pointer type or vice versa (5.2.10) | |
| Conversion is supported. The binary representation is preserved. | |
The result of
sizeof when applied to
fundamental types other than
char, signed
char, and unsigned char
(5.3.3) | |
See 9.2 Integer Data Types, noting that
sizeof() returns a size in
bytes. | |
| Whether over-aligned types are supported (5.3.4, 20.7.9.1, 20.7.11) | |
| Yes. | |
The type of
ptrdiff_t (5.7, 18.2) | |
int | |
| The result of a right shift of negative values (5.8) | |
| Bitwise operators act on the representation of the value including both the sign and value bits, where the sign bit is considered immediately above the highest-value value bit. | |
The meaning of
attribute declaration (7) | |
| See 9.10 Variable Attributes, 14.1.2 Function Attributes and 14.1.1 Function Specifiers. | |
| The underlying type for enumeration (7.2) | |
If the enumeration values are all
non-negative, the type is unsigned
int, else it is int.
| |
The meaning of the
asm declaration (7.4) | |
| See 17.2 Using Inline Assembly Language. | |
| The semantics of linkage specifiers (7.5) | |
| Only “C” and “C++” linkage are supported. | |
| The behavior of non-standard attributes (7.6.1) | |
| See 9.10 Variable Attributes, 14.1.2 Function Attributes and 14.1.1 Function Specifiers. | |
| The behavior of an attribute-scoped-token (7.6.1) | |
Attributes are available in the “gnu”
namespace and are equivalent to
__attribute__. | |
The string
resulting from __func__
(8.4.1) | |
| Treated as a constant expression and can be used in constexpr contexts. The string contains the function name only. | |
| The allocation of bit-fields within a class object (9.6) | |
| Bit fields are allocated left to right. | |
| The alignment of bit-fields within a class object (9.6) | |
| Each member is located to the lowest available offset allowable according to the alignment restrictions of the member type. | |
| The semantics of linkage specification on templates (14) | |
Only "C" and
"C++" linkage are
supported. | |
Whether the stack
is unwound before a call to
std::terminate() (15.3,
15.5.1) | |
| The stack is not unwound. | |
Whether the stack
is unwound before calling
std::terminate() when a
noexcept specification is
violated (15.5.1) | |
| The stack is not unwound. | |
The numeric values
of character literals in #if
directives (16.1) | |
| Interpreted in the same manner as they would on the target. | |
| Whether a single-character character literal may have a negative value (16.1) | |
| No | |
| The manner of search for included source files (16.2) | |
| Sequential, through a defined list of search paths. The search ends on the first match. | |
The nesting limit
for #include directives
(16.2) | |
| XC-DSC imposes a limit of 200 levels to avoid runaway recursion. | |
The search
locations for headers included using
"" (16.2) | |
The #include
"file" directive is used
for header files defined by your project. XC-DSC searches
for the file in the directory containing the current
source file, then in the quote directories, and then in
the system directories. You can prepend directories using
a command-line option. | |
The search
locations for headers included using
<> (16.2) | |
The #include
<file> directive
is used for system header files packaged with XC-DSC. You
can prepend search directories using a command-line
option. Directories are searched in the following
order: | |
| The sequence of places searched for a header (16.2) | |
| Quote form includes search the directory of the current file, then in the system directories. Angle-bracket form includes only search the system directories. | |
The behavior of a
#pragma directive (16.6) | |
| See 22.13 Preprocessing Directives (ISO 6.8.6). | |
The text equated
to __DATE__ when date of
translation is not available (16.8) | |
Expands to "??? ??
????" | |
The text equated
to __TIME__ when time of
translation is not available (16.8) | |
Expands to "??? ??
????" | |
Whether
__STDC_VERSION__ is a predefined
macro and what it means (16.8) | |
This macro is a long integer constant that
has the format
yyyymmL, where
yyyy is the year
and mm is the
month of the C Standard version with which the
compiler is compatible. This shows the C Standard
version to which the compiler conforms. | |
Whether
__STDC__ is a predefined macro
and what it means (16.8) | |
| In normal operation, this macro expands to the constant 1, to signify that this compiler conforms to ISO Standard C. | |
| The set of headers for a freestanding implementation (17.6.1.3) | |
Every header required by the standard
except <atomic>, those
being: | |
Whether a name
from the C standard library declared with external linkage
has extern "C" or extern
"C++" linkage (17.6.2.3) | |
extern "C++" | |
| The exceptions thrown by standard library functions that do not have an exception specification (17.6.5.12) | |
| There are no implementation-defined exception classes. | |
The
error_category for errors
originating outside the operating system
(17.6.5.14) | |
| None. | |
The type of
size_t (18.2) | |
unsigned int | |
| The form of the exit status returned to the host environment (18.5) | |
| Host environments are not supported. | |
The return value
of bad_alloc::what
(18.6.2.1) | |
| The name of the class. | |
The return value
of type_info::name()
(18.7.1) | |
| The mangled type name. | |
The return value
of bad_cast::what
(18.7.2) | |
| The name of the class. | |
The return value
of bad_typeid::what
(18.7.3) | |
| The name of the class. | |
The result of
exception::what (18.8.1) | |
| The name of the class. | |
The return value
of bad_exception::what
(18.8.2) | |
| The name of the class. | |
| The use of a non-POF (non-“plain old function”) as signal handler (18.10) | |
| Signals are not supported. | |
The exception type
when the shared_ptr constructor
fails (20.8.2.2.1) | |
std::bad_alloc | |
Whether
placeholder types are
CopyAssignable
(20.9.9.1.4) | |
| Yes. | |
| Whether extended alignment is supported (20.10.7.6) | |
| Yes. | |
Whether values are
rounded or truncated to the required precision
when converting between time_t
values and time_point objects
(20.12.7.1) | |
| Values are truncated. | |
The type of
streamoff (21.2.3.1) | |
long long | |
The type of
streampos (21.2.3.1) | |
Synonym for
| |
The return value
of
char_traits<char16_t>::eof
(21.2.3.2) | |
int_type(-1) | |
The type of
u16streampos (21.2.3.2) | |
Synonym for
fpos<mbstate_t> | |
The return value
of
char_traits<char32_t>::eof
(21.2.3.3) | |
int_type(-1) | |
The type of
u32streampos (21.2.3.3) | |
Synonym for
fpos<mbstate_t> | |
The type of
wstreampos (21.2.3.4) | |
Synonym for
fpos<mbstate_t> | |
| Whether locale object is global or per-thread (22.3.1) | |
| Locale object is global. | |
The effect on C
locale of calling locale::global
(22.3.1.5) | |
If the locale has a name, same as
setlocale(). | |
The value of
ctype<char>::table_size
(22.4.1.3) | |
SCHAR_MAX + 1 | |
The additional
formats accepted for
time_get::do_get_date
(22.4.5.1.2) | |
| None | |
Whether
time_get::do_get_year accepts
two-digit year numbers (22.4.5.1.2) | |
| Two-digit year numbers are accepted. | |
The formatted
character sequence generated by
time_put::do_put in the C locale
(22.4.5.3.2) | |
Same as strftime() | |
The type of
array::const_iterator
(23.3.2.1) | |
const T* | |
The type of
array::iterator
(23.3.2.1) | |
T* | |
The default number
of buckets in unordered_map when
this is not specified with the constructor
(23.5.4.2) | |
| 0 | |
The default number
of buckets in unordered_multimap
when this is not specified with the constructor
(23.5.5.2) | |
| 0 | |
The default number
of buckets in unordered_set when
this is not specified with the constructor
(23.5.6.2) | |
| 0 | |
The default number
of buckets in unordered_multiset
when this is not specified with the constructor
(23.5.7.2) | |
| 0 | |
The underlying
source of random numbers for
random_shuffle (25.3.12) | |
It uses rand() as the
source of randomness. | |
The effect of
calling ios_base::sync_with_stdio
after any input or output operation on standard
streams (27.5.3.4) | |
| The synchronization referred to is only that between the standard C facilities and the standard C++ objects. User-declared streams are unaffected. | |
The argument
values used to construct the fail
object of basic_ios::failure
thrown by basic_ios flags
functions (27.5.5.4) | |
const char& | |
Whether sequence
pointers are copied by
basic_stringbuf move constructor
(27.8.2.1) | |
| Sequence pointers are copied. | |
The effect of
calling basic_streambuf::setbuf
with non-zero arguments (27.8.2.4) | |
| If no buffer has already been created, and both arguments are non-zero, then the first argument is used as a buffer. | |
Whether sequence
pointers are copied by
basic_filebuf move constructor
(27.9.1.2) | |
| Sequence pointers are copied. | |
The effect of
calling basic_filebuf::setbuf
with non-zero arguments (27.9.1.5) | |
| The first argument is used as a buffer. | |
The effect of
calling basic_filebuf::sync when
a get area exists (27.9.1.5) | |
| No effect. | |
The type of
regex_constants::error_type
(28.5.3) | |
| Unscoped enumeration types. | |
The values of
various ATOMIC_..._LOCK_FREE
macros (29.4) | |
| Not supported. | |
Whether
get_pointer_safety returns
pointer_safety::relaxed or
pointer_safety::preferred if the
implementation has relaxed pointer safety
(29.4) | |
| Relaxed pointer safety. | |
The presence and
meaning of native_handle_type and
native_handle (30.2.3) | |
| Native handles are not supported. | |
The type of
ios_base::streamoff (D.6) | |
long long int | |
The type of
ios_base::streampos (D.6) | |
Typedef
fpos<mbstate_t> | |
