EmbeddedC _Generic Compatibility Across Language Mode Defaults
0 reputation · 19 Mar 2023, 19:51 UTC
The goal is to clarify how EmbeddedC's default language mode influences _Generic type-selection support and code portability across compiler versions.
According to available knowledge, EmbeddedC versions 2.2 and earlier silently discard the _Generic keyword, while versions 2.5 and newer treat it as a standard extension only when the -std=c99 flag is active; without that flag the keyword becomes unidentified. Documentation does not specify whether the implicit language mode defaults to C90 or C99, leaving developers uncertain about baseline compatibility.
Can a portable macro using _Generic be written to work across EmbeddedC versions spanning the reported thresholds? Does the compiler emit a diagnostic when _Generic appears in the default language mode? What mechanisms, if any, allow detection of the effective language mode at preprocessing time?