🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#36
From: Chris Hanson
Date: Thu, 03 Dec 2026 22:02
32 lines
3646 bytes
> On Dec 3, 2026, at 4:20 AM, Greg Troxel <gdt@lexort.com> wrote:
> 
> Chris Hanson <cmhanson@eschatologist.net> writes:
> 
>> I’m designing a subsystem (including system calls) and I’d like to use “typed enums” in the API rather than #define or anonymous enums and int parameters.
> 
> Would this mean that programs that either
>  use your API
>  include a header where this is defined
> 
> could only be compiled with a compiler in --std=c23 mode?

This is a good point. Apparently -current (both the userspace and kernel) are compiled in --std=c23 mode, but I didn’t check whether that was explicitly passed or whether it was the compiler’s default. The C committee has been *much* better about backwards compatibility with existing code in new standards than, say, C++, so compilers can be much more aggressive about enabling newer C standards by default.

Nonetheless, this would affect people trying to use alternative compilers with NetBSD’s system headers, so even if I did go forward with using a typed enum in this API, I’d still probably need to use macros to fall back to pre-C23 declarations (like Apple’s APIs do).

  — 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: <94AA8AC2-1142-4439-8701-1A03DF592A90@eschatologist.net>
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.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: <rmiik1amu7w.fsf@s1.lexort.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.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: 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 14:02:21 -0800
Organization: Newsgate at muc.de e.V.
Sender: tech-kern-owner@NetBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <94AA8AC2-1142-4439-8701-1A03DF592A90@eschatologist.net>
References: <rmiik1amu7w.fsf@s1.lexort.com>
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="19415"; 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-Abiding-Befitting: 49259bdf196b1bad_1796335352862_2539129565
X-MC-Loop-Signature: 1796335352862:2395967162
X-MC-Ingress-Time: 1796335352862
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eschatologist.net;
	s=dreamhost; t=1796335352;
	bh=JkRrQR0wDdWlQ/nDlbS1gJtiQcpIPmI+Ta51ss9zOys=;
	h=Content-Type:Content-Transfer-Encoding:From:Subject:Date:Cc:To;
	b=MpNS4QbW+2wGkrKp8bRGmTMWF1Yee5Gx6xwJZuHpQfixXuj3llnkBwIzEIbn/A1ms
	 QGoiz0+abS/JYm3/GGWf6TPgnlAsOpM/bABM9LVrYXuoH1Zfg4OLcUcOmmMAcqAFlZ
	 SzbCctvilllVQ4GwZS+rXL4vTqj9xRwszXHoCt6sOrjeMl+fPX0FCRtf1M4LucwMSi
	 nIkFfl7IozTWE33DbtdHHzlWGXzJyXgXYLSIyGLR+XjNhZZR7lM6SiUu0ubEy00bXv
	 BvhxMnfy5G7O+vBlf9nrREiKyOtDaZ2rIKQu6twNvVOhOkttPnAJrQhBTii0X/B431
	 JR8vt8QN8YV5A==
In-Reply-To: <rmiik1amu7w.fsf@s1.lexort.com>
Precedence: bulk
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes