🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#41
From: Chris Hanson
Date: Fri, 04 Dec 2026 00:04
35 lines
3747 bytes
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.

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


--
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: <CA84EAFD-3A55-48EF-85FE-AFA0F2A65414@eschatologist.net>
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
References: <20261203174842.166677fc@brun>

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: Chris Hanson <cmhanson@eschatologist.net>
Newsgroups: muc.lists.netbsd.tech.kern
Subject: Re: Do all -current compilers support C23 typed enum syntax?
Date: Thu, 3 Dec 2026 16:04:58 -0800
Organization: Newsgate at muc.de e.V.
Sender: tech-kern-owner@NetBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <CA84EAFD-3A55-48EF-85FE-AFA0F2A65414@eschatologist.net>
References: <20261203174842.166677fc@brun>
MIME-Version: 1.0 (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="98410"; mail-complaints-to="news-admin@muc.de"
Authentication-Results: mail.netbsd.org (amavisd-new);
	dkim=pass (2048-bit key) header.d=eschatologist.net
X-Sender-Id: dreamhost|x-authsender|cmhanson@eschatologist.net
X-Sender-Id: dreamhost|x-authsender|cmhanson@eschatologist.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|cmhanson@eschatologist.net
X-MailChannels-Auth-Id: dreamhost
X-Keen-Vacuous: 296102a73fe26394_1796342714290_1795127067
X-MC-Loop-Signature: 1796342714290:1923148261
X-MC-Ingress-Time: 1796342714289
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eschatologist.net;
	s=dreamhost; t=1796342708;
	bh=b+p+cjTXwABs8oH8QaqrNGj6yXZAWSZJ7thuX0IeeX4=;
	h=Content-Type:Content-Transfer-Encoding:From:Subject:Date:Cc:To;
	b=FVcQRZguSuk9RPLnyMLMYK1VDV5mt4umvxUZlmawDkkUZbvrzKhsUtvvJQdtG/o1X
	 VElkTl5BW1EY3TUhjRQFHHippG4q4JbrVM0p2Enqo40NHAgfuAq9nimUlxNPEdAJND
	 ZLq4tDgwZPPnguyE7OlEXSenmm8lWv9WqiCTpXfnTA96YgNO7yL/UtQ6Fx5m2J8niz
	 x3M/q+xgG05cU/vAouV0EPt03A1bqaxAWzU0irhmgYTlPcrdjebGAA98kd7EEPzXIC
	 hAD+oGT8zgFUTih1aswaPXoIBV7P72H44/OY7lJp5Q9PKZJYode8+90QYG6zC9rcNC
	 wwfi8v8SYN++A==
In-Reply-To: <20261203174842.166677fc@brun>
Precedence: bulk
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes