🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#29
From: Jan-Benedict Glaw
Date: Thu, 03 Dec 2026 09:33
105 lines
4997 bytes
--q2ADnWBJZq/REicc
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, 2026-12-02 23:36:21 -0800, Chris Hanson <cmhanson@eschatologist.net=
> wrote:
> I=E2=80=99m designing a subsystem (including system calls) and I=E2=80=99=
d like to
> use =E2=80=9Ctyped enums=E2=80=9D in the API rather than #define or anony=
mous enums
> and int parameters.
>=20
> For example:
>=20
>     typedef enum : int {
>             subsys_thing_a =3D 0,
>             subways_thing_b,
>     } subsys_thing_t;
>=20
>     int subsys_call(subsys_thing_t thing);
>=20
> Many years ago at Apple we brought these from C++ to Objective-C and
> C because they can dramatically improve debugging ergonomics, and
> they=E2=80=99re part of C23, but can we actually require C23 for -current?
>=20
> Experimentally, I=E2=80=99ve verified that they work without complaint or
> problem on virt68k (my preferred machine to use for experiments, for
> debugging ease) but I=E2=80=99d wonder about things like VAX.

There are two primary compilers used in NetBSD, see
src/external/gpl3/gcc{,.old}. Supporting specific versions of language
standards is primarily based on the compiler's version (or age), less
so on the backend. VAX is special among all platforms that NetBSD
support in that it predated IEEE 754 floating point support, so a
program that expects '754 fpu support will potentially fail in some
way. But those typedef'ed enums aren't FPU, so...


vax-template# gcc --version
gcc (nb4 20260926) 14.4.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

vax-template# uname -a
NetBSD vax-template.classiccmp 11.99.9 NetBSD 11.99.9 (GENERIC) #0: Wed Oct=
 28 09:49:53 UTC 2026  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/vax/com=
pile/GENERIC vax

vax-template# cat test.c=20
#include <stdio.h>

typedef enum: int {
        subsys_thing_a =3D 0,
        subways_thing_b,
} subsys_thing_t;

int
subsys_call (subsys_thing_t thing)
{
        printf ("Num: %i\n", (int) thing);
        return 0;
}

int
main (int argc, char *argv[])
{
        return subsys_call (subways_thing_b);
}


vax-template# gcc -Wall -Werror -pedantic -std=3Dc23 test.c=20

vax-template# ./a.out=20
Num: 1

vax-template#=20


Right now, _all_ NetBSD ports use the same GCC 14 (this is "gcc", not
"gcc.old"). The last to switch were m68k and alpha, which used gcc.old
until Oct 17, 2026, see src/share/mk/bsd.own.mk .

MfG, JBG

--=20

--q2ADnWBJZq/REicc
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQTuyxy0LZdoZCg4wHn0e/fOpyGp6wUCaxE3WgAKCRD0e/fOpyGp
65J4AP9JPRxPSV7LUVw9S5RqNEucEOS1oedCevrkW843YlqwlAEAw14y36MsaoGG
prQF6R7E4DR1c4JFPQawbVi8ht8+ZQ8=
=1uoX
-----END PGP SIGNATURE-----

--q2ADnWBJZq/REicc--

--
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: <axE3XqNLMXGfmAbI@lug-owl.de>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!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!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
References: <FDE08146-A944-4663-80AF-A6953560BF9D@eschatologist.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!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!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Newsgroups: muc.lists.netbsd.tech.kern
Subject: Re: Do all -current compilers support C23 typed enum syntax?
Date: Thu, 3 Dec 2026 10:33:18 +0100
Organization: Newsgate at muc.de e.V.
Sender: tech-kern-owner@NetBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <axE3XqNLMXGfmAbI@lug-owl.de>
References: <FDE08146-A944-4663-80AF-A6953560BF9D@eschatologist.net>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="q2ADnWBJZq/REicc"
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="72216"; mail-complaints-to="news-admin@muc.de"
Content-Disposition: inline
In-Reply-To: <FDE08146-A944-4663-80AF-A6953560BF9D@eschatologist.net>
X-Operating-System: Linux chamaeleon 6.12.113+deb13-amd64 
X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444  A961 1DBD 5E75 8399 E1BB
X-gpg-key: wwwkeys.de.pgp.net
X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear
 warfare test the bombastical terror of flooding the spy listeners explosion
 sex drugs and rock'n'roll
X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare
 test the bombastical terror of flooding the spy listeners explosion sex
 drugs and rock'n'roll
X-message-flag: Please send plain text messages only. Do not send HTML
 emails. Thank you. 
Precedence: bulk
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes