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.
For example:
typedef enum : int {
subsys_thing_a = 0,
subways_thing_b,
} subsys_thing_t;
int subsys_call(subsys_thing_t thing);
Many years ago at Apple we brought these from C++ to Objective-C and C because
they can dramatically improve debugging ergonomics, and they’re part of C23,
but can we actually require C23 for -current?
Experimentally, I’ve verified that they work without complaint or problem on
virt68k (my preferred machine to use for experiments, for debugging ease) but
I’d wonder about things like VAX.
In the worst case I can always create a wrapper macro (like we did at Apple) so
my API can work with compilers that both do and don’t support them, but it’d be
nice if I didn’t have to.
-- Chris