Den 2026-12-03 kl. 08:36, skrev Chris Hanson:

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?

Hi Chris,

can you explain in which situation you need to modify the type of an enum?  Since it is supposed to be (representable as) an int?

-- Ragge


Reply via email to