🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.netbsd.tech.kern
Article #43

Re: Do all -current compilers support C23 typed enum syntax?

#43
From: Bobby Bingham
Date: Fri, 04 Dec 2026 01:05
59 lines
4185 bytes
On Thu, 3 Dec 2026 16:04:58 -0800
Chris Hanson <cmhanson@eschatologist.net> wrote:

> On Dec 3, 2026, at 3:48 PM, Bobby Bingham <koorogi@koorogi.info>
> wrote:
> > 
> > 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.  
> 
> The language committees obviously disagree, as the specific language
> feature I’m talking about was added to C++ and then Objective-C and
> finally to C specifically so language users would no longer have to
> worry about this ABI risk.

I don't personally mind the use of this feature, though I would hope
any public header would be kept compatible with older versions of C, as
I see you've already suggested.

But I see the reason for this feature's existence as roughly the
reverse of how you're suggesting using it.  I see it as allowing
developers that want something like -fshort-enums a standardized way to
get that behavior without breaking ABI with everybody else, rather than
a way for developers who are happy with the compiler-chosen backing
type to accommodate ABI-breaking compiler flags.

That said, this is just my 2 cents.  I'm new here and can't speak for
the project.

> 
> More specifically, I’d say that using anonymous enums and int in APIs
> is coding around a flaw in C’s specification of enum, and that the
> explicit typing feature eliminates the need to code around this flaw.
> 
>   — Chris
> 

--
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: <20261203190534.11332ee1@brun>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!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
References: <CA84EAFD-3A55-48EF-85FE-AFA0F2A65414@eschatologist.net> <>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!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 19:05:34 -0600
Organization: Newsgate at muc.de e.V.
Sender: tech-kern-owner@NetBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <20261203190534.11332ee1@brun>
References: <CA84EAFD-3A55-48EF-85FE-AFA0F2A65414@eschatologist.net> <>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="40654"; mail-complaints-to="news-admin@muc.de"
Authentication-Results: mail.netbsd.org (amavisd-new);
	dkim=pass (2048-bit key) header.d=koorogi.info
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=20210418; bh=oXqqC0frFf1
	6LN4FTQjmyNZuaDcPCZjc06gghYF1kaI=; h=references:in-reply-to:subject:
	cc:to:from:date; d=koorogi.info; b=jD5SrjiRSiBgPq8Q7bE2If4pbxpu0Ffz976
	bbJYAZA1z3xVSuyrfPaPcnSPn2BDgUtHDDw7jsJJ005Ef7vNpqH6Vm+9ez6Nh5qbO4hrU6
	iAkYSV+Ff5ZxYU39e+kG/45MAabR6ccl8iBvYFL3i4bZ2UlZBQq1OVDGhbFDtufrSs1Rqs
	CVmZKwxFs0wjtKIuUYT8y35ZX20E+j0aSH0y5Tdg4QRnHstJIrkL2og7lIS/sievEJB8Hz
	z+HVxAKZWDU3S9IgsunK0SIxKOqR2CQmQdCnsbf1VMjhkiv/tAvswOalWPMhHJ8yRGxDWL
	8c6Bs/ouvCCqdSlWut0xfKEmOSg==
In-Reply-To: <CA84EAFD-3A55-48EF-85FE-AFA0F2A65414@eschatologist.net>
Precedence: bulk
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes