Keil Logo

C and C++ implementation compatibility

4.6 C and C++ implementation compatibility

Arm® Compiler 6 C and C++ implementation details differ from previous compiler versions.

The following table describes the C and C++ implementation detail differences.

Table 4-8 C and C++ implementation detail differences

Feature Older versions of Arm Compiler Arm Compiler 6
Integer operations
Shifts

int shifts > 0 && < 127

int left_shifts > 31 == 0

int right_shifts > 31 == 0

(for unsigned or positive)

int right_shifts > 31 == -1

(for negative)

long long shifts > 0 && < 63

Warns when shift amount > width of type.

You can use the -Wshift-count-overflow option to suppress this warning.

Integer division Checks that the sign of the remainder matches the sign of the numerator The sign of the remainder is not necessarily the same as the sign of the numerator.
Floating-point operations
Default standard IEEE 754 standard, rounding to nearest representable value, exceptions disabled by default.

All facilities, operations, and representations guaranteed by the IEEE standard are available in single and double-precision. Modes of operation can be selected dynamically at runtime.

This is equivalent to the --fpmode=ieee_full option in older versions of Arm Compiler.

#pragma STDC FP_CONTRACT #pragma STDC FP_CONTRACT Might affect code generation.
Unions, enums and structs
Enum packing Enums are implemented in the smallest integral type of the correct sign to hold the range of the enum values, except for when compiling in C++ mode with --enum_is_int. By default enums are implemented as int, with long long used when required.
Allocation of bit-fields in containers Allocation of bit-fields in containers. A container is an object, aligned as the declared type. Its size is sufficient to contain the bit-field, but might be smaller or larger than the bit-field declared type.
Signedness of plain bit-fields

Unsigned.

Plain bit-fields declared without either the signed or unsigned qualifiers default to unsigned. The --signed_bitfields option treats plain bit-fields as signed.

Signed.

Plain bit-fields declared without either the signed or unsigned qualifiers default to signed. There is no equivalent to either the --signed_bitfields or --no_signed_bitfields options.

Arrays and pointers
Casting between integers and pointers No change of representation

Converting a signed integer to a pointer type with greater bit width sign-extends the integer.

Converting an unsigned integer to a pointer type with greater bit width zero-extends the integer.

Misc C
sizeof(wchar_t) 2 bytes 4 bytes
size_t Defined as unsigned int, 32-bit. Defined as unsigned int in 32-bit architectures, and <sign><type> 64-bit in 64-bit architectures.
ptrdiff_t Defined as signed int, 32-bit. Defined as unsigned int in 32-bit architectures, and <sign><type> 64-bit in 64-bit architectures.
Misc C++
C++ library Rogue Wave Standard C++ Library

LLVM libc++ Library

Note:

  • When the C++ library is used in source code, there is limited compatibility between object code created with Arm Compiler 6 and object code created with Arm Compiler 5. This also applies to indirect use of the C++ library, for example memory allocation or exception handling.
Implicit inclusion If compilation requires a template definition from a template declared in a header file xyz.h, the compiler implicitly includes the file xyz.cc or xyz.CC. Not supported.
Alternative template lookup algorithms When performing referencing context lookups, name lookup matches against names from the instantiation context as well as from the template definition context. Not supported.
Exceptions Off by default, function unwinding on with --exceptions by default.

On by default in C++ mode.

Note:

For C++ code, -fexceptions has a large increase in the code size. If you use -fno_exceptions, then the code size is in the range of that created with Arm Compiler 5.
Translation
Diagnostics messages format source-file, line-number : severity : error-code : explanation source-file:line-number:char-number: description [diagnostic-flag]
Environment
Physical source file bytes interpretation Current system locale dependent or set using the --locale command-line option. UTF-8
Non-ConfidentialPDF file icon PDF version100068_0613_00_en
Copyright © 2014–2019 Arm Limited or its affiliates. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.