Article View: muc.lists.netbsd.tech.kern
Article #55Re: Do all -current compilers support C23 typed enum syntax?
From: Taylor R Campbell
Date: Fri, 04 Dec 2026 14:34
Date: Fri, 04 Dec 2026 14:34
46 lines
3870 bytes
3870 bytes
> Date: Fri, 4 Dec 2026 00:24:53 -0500
> From: Thor Lancelot Simon <tls@panix.com>
>
> On Thu, Dec 03, 2026 at 08:31:18PM -0800, Chris Hanson wrote:
> >
> > In general, this is not a fruitful line of discussion: Compilers
> > do exist to serve their users, but those users have many different
> > and competing needs, and optimization for both speed and size are
> > among them. And the language specification is ultimately what
> > defines "broken" when it comes to how to best meet those needs.
>
> I have been avoiding so far in this conversation noting that really,
> this all stems from Apple buying itself a 50 gallon drum of trouble
> by just begging for UB by using "enum" in ABI elements, but, this
> seems like the time to say it.
>
> You have to understand the limitations of the language you're
> working in -- or, if you have a polyglot ecosystem, the languages.
> Using enum in a binary interface to other people's code bespeaks
> profound misunderstanding of the limitations of C and papering over
> it afterwards is bound to be fraught.
I believe Chris already addressed this, so perhaps it's not necessary
to ascribe a profound misunderstanding of the limitations:
https://mail-index.netbsd.org/tech-kern/2026/12/04/msg031347.html
Whether we want to adopt the same approach is a different question,
but evidently Chris and the engineers at Apple who adopted that
approach do understand the limitations of C enums.
For NetBSD's C header files, we are not going to unconditionally use
C23 typed enums -- that's obviously a nonstarter. But I'm open to
hearing a proposal describing:
(a) macros that _conditionally_ use C23 typed enums and other compiler
extensions,
(b) two or three specific use-cases for them, and
(c) specific benefits in terms of reliable compiler diagnostics and
ABI stability.
--
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:
<20261204143456.1CE7184E9B@mail.netbsd.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mailReferences:
<axJOpU_bzJC_LUSU@panix.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail From: Taylor R Campbell <riastradh@NetBSD.org> Newsgroups: muc.lists.netbsd.tech.kern Subject: Re: Do all -current compilers support C23 typed enum syntax? Date: Fri, 4 Dec 2026 14:34:55 +0000 Organization: Newsgate at muc.de e.V. Sender: tech-kern-owner@NetBSD.org Approved: news-admin@muc.de Distribution: world Message-ID: <20261204143456.1CE7184E9B@mail.netbsd.org> References: <axJOpU_bzJC_LUSU@panix.com> 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="93477"; mail-complaints-to="news-admin@muc.de" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1796394899; bh=eDdNvyHr/WwgVX4e5iPyTdnBQIdNKWwmOIt3OHeVb1c=; h=To:CC:In-reply-to:Subject:Date:From:List-Id:List-Unsubscribe; b=yyiW0W0G10dWf5czbZJXjESgzG+X6nz4BXjz5jH1iq2T7wcblpm1AR5FNhfTuuyz+ jZCDB4N3o3AxUhdQVoGZewz3VtH20k8wkuMhdyhTynGDOR/ruDBXt2wFflFA2IQVwc pESnc99dTNrqI8oM0Qw1pGbttm2M4PQxuiKdwHGo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1796394896; bh=eDdNvyHr/WwgVX4e5iPyTdnBQIdNKWwmOIt3OHeVb1c=; h=To:CC:In-reply-to:Subject:Date:From; b=cULwhNLTqPhtFxc+q9ErNr+W3vABz5iGL3eutLPp78+NbYPN5jiAAC4IyeqIbfk8H U+4y15qm4INOTytt/stlrovp5G06pf9SqEd736Rdiot3F138jMBESK+1QYaMX4UyKI zr8//bhAMWiZ/d5bIaD5Bi/YBh8lnf0RpjPSVNUQ= In-reply-to: <axJOpU_bzJC_LUSU@panix.com> (tls@panix.com) Precedence: bulk X-Newsgate-Id: f02c70b8849f+ X-No-Archive: Yes