tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Do all -current compilers support C23 typed enum syntax?
On Thu, 3 Dec 2026 13:54:20 -0800
Chris Hanson <cmhanson%eschatologist.net@localhost> wrote:
> The problem is that without attaching a specific type, the language
> allows the compiler to choose the type to use to represent the
> enumeration, which means it can change based on things like compiler
> options, which in turn means the use of enum for defining types is
> not ABI-stable.
There are many compiler options that can change the ABI in incompatible
ways, ranging from completely incompatible (e.g., -m32/-m64) to more
subtle differences (-m[no-]align-double, -mlong-double-*,
-mpreferred-stack-boundary, -msoft-float on some targets, etc).
I don't think the solution is to try to code around these options, but
to say they shouldn't be used where ABI compatibility matters.
In fact, the gcc manpage says just that for the -fshort-enums option:
Warning: the -fshort-enums switch causes GCC to generate code that
is not binary compatible with code generated without that switch.
--
Bobby
Home |
Main Index |
Thread Index |
Old Index