Keywords: sdccman

## 3.1.5 ISO C2X

Use —std-c2x to compile in this mode.

Deviations from standard compliance:

- initialization of structure arrays must be fully braced.

  > struct s { char x } a[] = {1, 2}; /* invalid in SDCC */
  > struct s { char x } a[] = {{1}, {2}}; /* OK */

- 'double' precision floating point not supported. Instead a warning is emitted, and float is used instead. long double is treated the same.
- Compund literals are not supported.
- Support for attributes is slightly incomplete.
- The preprocessor is not C2X-compatible.
- Checked integer arithmetic is not supported for (unsigned) long long.
- Qualifier-preserving standard library functions are not implemented.
- Enhanced enumerations are not implemented.
- constexpr is not implemented.
- SDCC deviates from the current C2X standard draft N3047 in tag compatibility for unions: in SDCC, redeclarations of unions are required to have their members in the same order as previous declarations. The rule in N3047 is now considered a mistake by many, and will hopefully be changed to the SDCC behaviour via a national body comment for the final version of the standard.

Some features of this standard are not supported in some ports:

- hc08, s08, mos6502, pic14, pic16: structures and unions cannot be passed as function parameters and cannot be a return value from a function, e.g.:

  > struct s { ... };
  > struct s foo1 (struct s parms) /* invalid in SDCC although allowed in ANSI */
  > {
  > struct s rets;
  > ...
  > return rets; /* is invalid in SDCC although allowed in ANSI */
  > }

- mcs51, ds390, hc08, s08, pdk13, pdk14, pdk15 and mos6502 ports: functions are not reentrant unless explicitly declared as such or --stack-auto is specified.
- pic14, pic16: there is no support for data types long long, unsigned long long, int_fast64_t, int_least64_t, int64_t, uint_fast64_t, uint_least64_t, uint64_t.
- pic14, pic16: _BitInt is not supported.