Article View: muc.lists.netbsd.tech.kern
Article #39Re: Do all -current compilers support C23 typed enum syntax?
From: Bobby Bingham
Date: Thu, 03 Dec 2026 23:48
Date: Thu, 03 Dec 2026 23:48
28 lines
3003 bytes
3003 bytes
On Thu, 3 Dec 2026 13:54:20 -0800
Chris Hanson <cmhanson@eschatologist.net> 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
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<20261203174842.166677fc@brun>Path:
mbox-mo1.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mailReferences:
<> <950F1479-FF19-4169-92AF-382193ECF93A@eschatologist.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail From: Bobby Bingham <koorogi@koorogi.info> Newsgroups: muc.lists.netbsd.tech.kern Subject: Re: Do all -current compilers support C23 typed enum syntax? Date: Thu, 3 Dec 2026 17:48:42 -0600 Organization: Newsgate at muc.de e.V. Sender: tech-kern-owner@NetBSD.org Approved: news-admin@muc.de Distribution: world Message-ID: <20261203174842.166677fc@brun> References: <> <950F1479-FF19-4169-92AF-382193ECF93A@eschatologist.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="90381"; mail-complaints-to="news-admin@muc.de" Authentication-Results: mail.netbsd.org (amavisd-new); dkim=pass (2048-bit key) header.d=koorogi.info X-Greylist: delayed 399 seconds by postgrey-1.37 at homeworld.NetBSD.org; Thu, 03 Dec 2026 23:55:28 UTC DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=20210418; bh=83+uWDwNFVj p/9SxiaL9Y74iimchNloF2zQ/SBbBkWw=; h=references:in-reply-to:subject: cc:to:from:date; d=koorogi.info; b=mUMrvuZC4thbpnuLO1pcXmdqwa8awvwC3en tP9KqIu0kdTDSqTRsQfg4f3LggVN4rZzDrr2vEKZInX2vvaGPWUBlSYWjVdszx4zN+vbfT aF2UMwbVAA6HfHX0K0YqqjLNFe4+P9BcTsoCZKzo4qad2T7Wr9d3ctqzD4Us6SAtC2WD/x neme4JUa+SLqlujPXiE09hjZXivaOnOfeulc8sppJ/WoiHXCX/QdQSugDmKoBCHfZAT0ju rUpZq5YiRWqkopojKeU6fiZ6rZnzHvY1dU8uNIMismEqb5KztJoER+T9aZR5o/2lmNfxPz GUtDVV0zV0MiLm/S5psMcplNXYg== In-Reply-To: <950F1479-FF19-4169-92AF-382193ECF93A@eschatologist.net> Precedence: bulk X-Newsgate-Id: f02c70b8849f+ X-No-Archive: Yes